<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

Extracting imported and top-level names in scope
-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP, NondecreasingIndentation, MultiWayIf, NamedFieldPuns #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns   #-}</span><span>
</span><span id="line-14"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Rename.Names</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#rnImports"><span class="hs-identifier">rnImports</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#getLocalNonValBinders"><span class="hs-identifier">getLocalNonValBinders</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier">newRecordSelector</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#extendGlobalRdrEnvRn"><span class="hs-identifier">extendGlobalRdrEnvRn</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier">gresFromAvails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#calculateAvails"><span class="hs-identifier">calculateAvails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#reportUnusedNames"><span class="hs-identifier">reportUnusedNames</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#checkConName"><span class="hs-identifier">checkConName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#mkChildEnv"><span class="hs-identifier">mkChildEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#findChildren"><span class="hs-identifier">findChildren</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#dodgyMsg"><span class="hs-identifier">dodgyMsg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#dodgyMsgInsert"><span class="hs-identifier">dodgyMsgInsert</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#findImportUsage"><span class="hs-identifier">findImportUsage</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#getMinimalImports"><span class="hs-identifier">getMinimalImports</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#printMinimalImports"><span class="hs-identifier">printMinimalImports</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier">ImportDeclUsage</span></a></span><span>
</span><span id="line-31"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Env.html"><span class="hs-identifier">GHC.Rename.Env</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Fixity.html"><span class="hs-identifier">GHC.Rename.Fixity</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Utils.html"><span class="hs-identifier">GHC.Rename.Utils</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Rename.Utils.html#warnUnusedTopBinds"><span class="hs-identifier">warnUnusedTopBinds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Rename.Utils.html#mkFieldEnv"><span class="hs-identifier">mkFieldEnv</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html"><span class="hs-identifier">GHC.Iface.Load</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html#loadSrcInterface"><span class="hs-identifier">loadSrcInterface</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html"><span class="hs-identifier">GHC.Types.Name.Set</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html"><span class="hs-identifier">GHC.Types.Avail</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html"><span class="hs-identifier">GHC.Types.FieldLabel</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.html"><span class="hs-identifier">GHC.Parser.PostProcess</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.html#setRdrNameSpace"><span class="hs-identifier">setRdrNameSpace</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outputable</span></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">SrcLoc</span></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier">TopLevelFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#StringLiteral"><span class="hs-identifier">StringLiteral</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Utils</span></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.Env.html"><span class="hs-identifier">GHC.Data.FastString.Env</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html"><span class="hs-identifier">GHC.Core.PatSyn</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#"><span class="hs-identifier">Data.Either</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#partitionEithers"><span class="hs-identifier">partitionEithers</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#isRight"><span class="hs-identifier">isRight</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#rights"><span class="hs-identifier">rights</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier">Map</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Map</span></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ord.html#"><span class="hs-identifier">Data.Ord</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier">comparing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier">find</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier">sortBy</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Function.html#"><span class="hs-identifier">Data.Function</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Function.html#on"><span class="hs-identifier">on</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator">(&lt;/&gt;)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{rnImports}
*                                                                      *
************************************************************************

Note [Tracking Trust Transitively]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we import a package as well as checking that the direct imports are safe
according to the rules outlined in the Note [Safe Haskell Trust Check] in GHC.Driver.Main
we must also check that these rules hold transitively for all dependent modules
and packages. Doing this without caching any trust information would be very
slow as we would need to touch all packages and interface files a module depends
on. To avoid this we make use of the property that if a modules Safe Haskell
mode changes, this triggers a recompilation from that module in the dependcy
graph. So we can just worry mostly about direct imports.

There is one trust property that can change for a package though without
recompilation being triggered: package trust. So we must check that all
packages a module transitively depends on to be trusted are still trusted when
we are compiling this module (as due to recompilation avoidance some modules
below may not be considered trusted any more without recompilation being
triggered).

We handle this by augmenting the existing transitive list of packages a module M
depends on with a bool for each package that says if it must be trusted when the
module M is being checked for trust. This list of trust required packages for a
single import is gathered in the rnImportDecl function and stored in an
ImportAvails data structure. The union of these trust required packages for all
imports is done by the rnImports function using the combine function which calls
the plusImportAvails function that is a union operation for the ImportAvails
type. This gives us in an ImportAvails structure all packages required to be
trusted for the module we are currently compiling. Checking that these packages
are still trusted (and that direct imports are trusted) is done in
GHC.Driver.Main.checkSafeImports.

See the note below, [Trust Own Package] for a corner case in this method and
how its handled.


Note [Trust Own Package]
~~~~~~~~~~~~~~~~~~~~~~~~
There is a corner case of package trust checking that the usual transitive check
doesn't cover. (For how the usual check operates see the Note [Tracking Trust
Transitively] below). The case is when you import a -XSafe module M and M
imports a -XTrustworthy module N. If N resides in a different package than M,
then the usual check works as M will record a package dependency on N's package
and mark it as required to be trusted. If N resides in the same package as M
though, then importing M should require its own package be trusted due to N
(since M is -XSafe so doesn't create this requirement by itself). The usual
check fails as a module doesn't record a package dependency of its own package.
So instead we now have a bool field in a modules interface file that simply
states if the module requires its own package to be trusted. This field avoids
us having to load all interface files that the module depends on to see if one
is trustworthy.


Note [Trust Transitive Property]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So there is an interesting design question in regards to transitive trust
checking. Say I have a module B compiled with -XSafe. B is dependent on a bunch
of modules and packages, some packages it requires to be trusted as its using
-XTrustworthy modules from them. Now if I have a module A that doesn't use safe
haskell at all and simply imports B, should A inherit all the trust
requirements from B? Should A now also require that a package p is trusted since
B required it?

We currently say no but saying yes also makes sense. The difference is, if a
module M that doesn't use Safe Haskell imports a module N that does, should all
the trusted package requirements be dropped since M didn't declare that it cares
about Safe Haskell (so -XSafe is more strongly associated with the module doing
the importing) or should it be done still since the author of the module N that
uses Safe Haskell said they cared (so -XSafe is more strongly associated with
the module that was compiled that used it).

Going with yes is a simpler semantics we think and harder for the user to stuff
up but it does mean that Safe Haskell will affect users who don't care about
Safe Haskell as they might grab a package from Cabal which uses safe haskell (say
network) and that packages imports -XTrustworthy modules from another package
(say bytestring), so requires that package is trusted. The user may now get
compilation errors in code that doesn't do anything with Safe Haskell simply
because they are using the network package. They will have to call 'ghc-pkg
trust network' to get everything working. Due to this invasive nature of going
with yes we have gone with no for now.
-}</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="hs-comment">-- | Process Import Decls.  See 'rnImportDecl' for a description of what</span><span>
</span><span id="line-168"></span><span class="hs-comment">-- the return types represent.</span><span>
</span><span id="line-169"></span><span class="hs-comment">-- Note: Do the non SOURCE ones first, so that we get a helpful warning</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- for SOURCE ones that are unnecessary</span><span>
</span><span id="line-171"></span><span class="annot"><a href="GHC.Rename.Names.html#rnImports"><span class="hs-identifier hs-type">rnImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-172"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#AnyHpcUsage"><span class="hs-identifier hs-type">AnyHpcUsage</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span id="rnImports"><span class="annot"><span class="annottext">rnImports :: [LImportDecl GhcPs]
-&gt; RnM ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool)
</span><a href="GHC.Rename.Names.html#rnImports"><span class="hs-identifier hs-var hs-var">rnImports</span></a></span></span><span> </span><span id="local-6989586621681136232"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136232"><span class="hs-identifier hs-var">imports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621681136231"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136231"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-175"></span><span>    </span><span class="hs-comment">-- NB: want an identity module here, because it's OK for a signature</span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-comment">-- module to import from its implementor</span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681136229"><span class="annot"><span class="annottext">this_mod :: Module
</span><a href="#local-6989586621681136229"><span class="hs-identifier hs-var hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136231"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681136227"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136227"><span class="hs-identifier hs-var">source</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136226"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136226"><span class="hs-identifier hs-var">ordinary</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcPs -&gt; Bool)
-&gt; [LImportDecl GhcPs]
-&gt; ([LImportDecl GhcPs], [LImportDecl GhcPs])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcPs -&gt; Bool
forall {l} {pass}. GenLocated l (ImportDecl pass) -&gt; Bool
</span><a href="#local-6989586621681136225"><span class="hs-identifier hs-var">is_source_import</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136232"><span class="hs-identifier hs-var">imports</span></a></span><span>
</span><span id="line-179"></span><span>        </span><span id="local-6989586621681136225"><span class="annot"><span class="annottext">is_source_import :: GenLocated l (ImportDecl pass) -&gt; Bool
</span><a href="#local-6989586621681136225"><span class="hs-identifier hs-var hs-var">is_source_import</span></a></span></span><span> </span><span id="local-6989586621681136223"><span class="annot"><span class="annottext">GenLocated l (ImportDecl pass)
</span><a href="#local-6989586621681136223"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportDecl pass -&gt; IsBootInterface
forall pass. ImportDecl pass -&gt; IsBootInterface
</span><a href="GHC.Hs.ImpExp.html#ideclSource"><span class="hs-identifier hs-var hs-var">ideclSource</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated l (ImportDecl pass) -&gt; ImportDecl pass
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated l (ImportDecl pass)
</span><a href="#local-6989586621681136223"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IsBootInterface -&gt; IsBootInterface -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span id="local-6989586621681136219"><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136219"><span class="hs-identifier hs-var">stuff1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcPs
 -&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool))
-&gt; [LImportDecl GhcPs]
-&gt; TcRn [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
forall a b. (a -&gt; TcRn b) -&gt; [a] -&gt; TcRn [b]
</span><a href="GHC.Tc.Utils.Monad.html#mapAndReportM"><span class="hs-identifier hs-var">mapAndReportM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module
-&gt; LImportDecl GhcPs
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
</span><a href="GHC.Rename.Names.html#rnImportDecl"><span class="hs-identifier hs-var">rnImportDecl</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136229"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136226"><span class="hs-identifier hs-var">ordinary</span></a></span><span>
</span><span id="line-181"></span><span>    </span><span id="local-6989586621681136216"><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136216"><span class="hs-identifier hs-var">stuff2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcPs
 -&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool))
-&gt; [LImportDecl GhcPs]
-&gt; TcRn [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
forall a b. (a -&gt; TcRn b) -&gt; [a] -&gt; TcRn [b]
</span><a href="GHC.Tc.Utils.Monad.html#mapAndReportM"><span class="hs-identifier hs-var">mapAndReportM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module
-&gt; LImportDecl GhcPs
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
</span><a href="GHC.Rename.Names.html#rnImportDecl"><span class="hs-identifier hs-var">rnImportDecl</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136229"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621681136227"><span class="hs-identifier hs-var">source</span></a></span><span>
</span><span id="line-182"></span><span>    </span><span class="hs-comment">-- Safe Haskell: See Note [Tracking Trust Transitively]</span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681136215"><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681136215"><span class="hs-identifier hs-var">decls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136214"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136214"><span class="hs-identifier hs-var">rdr_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136213"><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136213"><span class="hs-identifier hs-var">imp_avails</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136212"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136212"><span class="hs-identifier hs-var">hpc_usage</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool)
</span><a href="#local-6989586621681136211"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136219"><span class="hs-identifier hs-var">stuff1</span></a></span><span> </span><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
-&gt; [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
-&gt; [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136216"><span class="hs-identifier hs-var">stuff2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-184"></span><span>    </span><span class="annot"><span class="annottext">([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool)
-&gt; RnM ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681136215"><span class="hs-identifier hs-var">decls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136214"><span class="hs-identifier hs-var">rdr_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136213"><span class="hs-identifier hs-var">imp_avails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136212"><span class="hs-identifier hs-var">hpc_usage</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-187"></span><span>    </span><span class="hs-comment">-- See Note [Combining ImportAvails]</span><span>
</span><span id="line-188"></span><span>    </span><span class="annot"><a href="#local-6989586621681136211"><span class="hs-identifier hs-type">combine</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#AnyHpcUsage"><span class="hs-identifier hs-type">AnyHpcUsage</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-189"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#AnyHpcUsage"><span class="hs-identifier hs-type">AnyHpcUsage</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>    </span><span id="local-6989586621681136211"><span class="annot"><span class="annottext">combine :: [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool)
</span><a href="#local-6989586621681136211"><span class="hs-identifier hs-var hs-var">combine</span></a></span></span><span> </span><span id="local-6989586621681136210"><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136210"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-191"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681136209"><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681136209"><span class="hs-identifier hs-var">decls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136208"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136208"><span class="hs-identifier hs-var">rdr_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136207"><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136207"><span class="hs-identifier hs-var">imp_avails</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136206"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136206"><span class="hs-identifier hs-var">hpc_usage</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136205"><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681136205"><span class="hs-identifier hs-var">finsts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
 -&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
     ModuleSet)
 -&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
     ModuleSet))
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
    ModuleSet)
-&gt; [(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
    ModuleSet)
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span>
</span><span id="line-192"></span><span>            </span><span class="annot"><span class="annottext">(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
    ModuleSet)
-&gt; ([LImportDecl GhcRn], GlobalRdrEnv, ImportAvails, Bool,
    ModuleSet)
forall {a}.
(a, GlobalRdrEnv, ImportAvails, Bool)
-&gt; ([a], GlobalRdrEnv, ImportAvails, Bool, ModuleSet)
-&gt; ([a], GlobalRdrEnv, ImportAvails, Bool, ModuleSet)
</span><a href="#local-6989586621681136203"><span class="hs-identifier hs-var">plus</span></a></span><span>
</span><span id="line-193"></span><span>            </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#emptyGlobalRdrEnv"><span class="hs-identifier hs-var">emptyGlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="GHC.Tc.Types.html#emptyImportAvails"><span class="hs-identifier hs-var">emptyImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleSet
</span><a href="GHC.Unit.Module.Env.html#emptyModuleSet"><span class="hs-identifier hs-var">emptyModuleSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span>            </span><span class="annot"><span class="annottext">[(LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)]
</span><a href="#local-6989586621681136210"><span class="hs-identifier hs-var">ss</span></a></span><span>
</span><span id="line-195"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681136209"><span class="hs-identifier hs-var">decls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136208"><span class="hs-identifier hs-var">rdr_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136207"><span class="hs-identifier hs-var">imp_avails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_finsts :: [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleSet -&gt; [Module]
</span><a href="GHC.Unit.Module.Env.html#moduleSetElts"><span class="hs-identifier hs-var">moduleSetElts</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681136205"><span class="hs-identifier hs-var">finsts</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-196"></span><span>            </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136206"><span class="hs-identifier hs-var">hpc_usage</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>    </span><span id="local-6989586621681136203"><span class="annot"><span class="annottext">plus :: (a, GlobalRdrEnv, ImportAvails, Bool)
-&gt; ([a], GlobalRdrEnv, ImportAvails, Bool, ModuleSet)
-&gt; ([a], GlobalRdrEnv, ImportAvails, Bool, ModuleSet)
</span><a href="#local-6989586621681136203"><span class="hs-identifier hs-var hs-var">plus</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681136197"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681136197"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621681136196"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136196"><span class="hs-identifier hs-var">gbl_env1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136195"><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136195"><span class="hs-identifier hs-var">imp_avails1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136194"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136194"><span class="hs-identifier hs-var">hpc_usage1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621681136193"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681136193"><span class="hs-identifier hs-var">decls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136192"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136192"><span class="hs-identifier hs-var">gbl_env2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136191"><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136191"><span class="hs-identifier hs-var">imp_avails2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136190"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136190"><span class="hs-identifier hs-var">hpc_usage2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136189"><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681136189"><span class="hs-identifier hs-var">finsts_set</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681136197"><span class="hs-identifier hs-var">decl</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681136193"><span class="hs-identifier hs-var">decls</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-201"></span><span>          </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136196"><span class="hs-identifier hs-var">gbl_env1</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; GlobalRdrEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#plusGlobalRdrEnv"><span class="hs-operator hs-var">`plusGlobalRdrEnv`</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681136192"><span class="hs-identifier hs-var">gbl_env2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-202"></span><span>          </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136187"><span class="hs-identifier hs-var">imp_avails1'</span></a></span><span> </span><span class="annot"><span class="annottext">ImportAvails -&gt; ImportAvails -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-operator hs-var">`plusImportAvails`</span></a></span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136191"><span class="hs-identifier hs-var">imp_avails2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-203"></span><span>          </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136194"><span class="hs-identifier hs-var">hpc_usage1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136190"><span class="hs-identifier hs-var">hpc_usage2</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-204"></span><span>          </span><span class="annot"><span class="annottext">ModuleSet -&gt; [Module] -&gt; ModuleSet
</span><a href="GHC.Unit.Module.Env.html#extendModuleSetList"><span class="hs-identifier hs-var">extendModuleSetList</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681136189"><span class="hs-identifier hs-var">finsts_set</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681136183"><span class="hs-identifier hs-var">new_finsts</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-206"></span><span>      </span><span id="local-6989586621681136187"><span class="annot"><span class="annottext">imp_avails1' :: ImportAvails
</span><a href="#local-6989586621681136187"><span class="hs-identifier hs-var hs-var">imp_avails1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136195"><span class="hs-identifier hs-var">imp_avails1</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">imp_finsts :: [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-207"></span><span>      </span><span id="local-6989586621681136183"><span class="annot"><span class="annottext">new_finsts :: [Module]
</span><a href="#local-6989586621681136183"><span class="hs-identifier hs-var hs-var">new_finsts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails -&gt; [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var hs-var">imp_finsts</span></a></span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681136195"><span class="hs-identifier hs-var">imp_avails1</span></a></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span class="hs-comment">{-
Note [Combining ImportAvails]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imp_finsts in ImportAvails is a list of family instance modules
transitively depended on by an import. imp_finsts for a currently
compiled module is a union of all the imp_finsts of imports.
Computing the union of two lists of size N is O(N^2) and if we
do it to M imports we end up with O(M*N^2). That can get very
expensive for bigger module hierarchies.

Union can be optimized to O(N log N) if we use a Set.
imp_finsts is converted back and forth between dep_finsts, so
changing a type of imp_finsts means either paying for the conversions
or changing the type of dep_finsts as well.

I've measured that the conversions would cost 20% of allocations on my
test case, so that can be ruled out.

Changing the type of dep_finsts forces checkFamInsts to
get the module lists in non-deterministic order. If we wanted to restore
the deterministic order, we'd have to sort there, which is an additional
cost. As far as I can tell, using a non-deterministic order is fine there,
but that's a brittle nonlocal property which I'd like to avoid.

Additionally, dep_finsts is read from an interface file, so its &quot;natural&quot;
type is a list. Which makes it a natural type for imp_finsts.

Since rnImports.combine is really the only place that would benefit from
it being a Set, it makes sense to optimize the hot loop in rnImports.combine
without changing the representation.

So here's what we do: instead of naively merging ImportAvails with
plusImportAvails in a loop, we make plusImportAvails merge empty imp_finsts
and compute the union on the side using Sets. When we're done, we can
convert it back to a list. One nice side effect of this approach is that
if there's a lot of overlap in the imp_finsts of imports, the
Set doesn't really need to grow and we don't need to allocate.

Running generateModules from #14693 with DEPTH=16, WIDTH=30 finishes in
23s before, and 11s after.
-}</span><span>
</span><span id="line-250"></span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="hs-comment">-- | Given a located import declaration @decl@ from @this_mod@,</span><span>
</span><span id="line-254"></span><span class="hs-comment">-- calculate the following pieces of information:</span><span>
</span><span id="line-255"></span><span class="hs-comment">--</span><span>
</span><span id="line-256"></span><span class="hs-comment">--  1. An updated 'LImportDecl', where all unresolved 'RdrName' in</span><span>
</span><span id="line-257"></span><span class="hs-comment">--     the entity lists have been resolved into 'Name's,</span><span>
</span><span id="line-258"></span><span class="hs-comment">--</span><span>
</span><span id="line-259"></span><span class="hs-comment">--  2. A 'GlobalRdrEnv' representing the new identifiers that were</span><span>
</span><span id="line-260"></span><span class="hs-comment">--     brought into scope (taking into account module qualification</span><span>
</span><span id="line-261"></span><span class="hs-comment">--     and hiding),</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">--  3. 'ImportAvails' summarizing the identifiers that were imported</span><span>
</span><span id="line-264"></span><span class="hs-comment">--     by this declaration, and</span><span>
</span><span id="line-265"></span><span class="hs-comment">--</span><span>
</span><span id="line-266"></span><span class="hs-comment">--  4. A boolean 'AnyHpcUsage' which is true if the imported module</span><span>
</span><span id="line-267"></span><span class="hs-comment">--     used HPC.</span><span>
</span><span id="line-268"></span><span class="annot"><a href="GHC.Rename.Names.html#rnImportDecl"><span class="hs-identifier hs-type">rnImportDecl</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-269"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#AnyHpcUsage"><span class="hs-identifier hs-type">AnyHpcUsage</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span id="rnImportDecl"><span class="annot"><span class="annottext">rnImportDecl :: Module
-&gt; LImportDecl GhcPs
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
</span><a href="GHC.Rename.Names.html#rnImportDecl"><span class="hs-identifier hs-var hs-var">rnImportDecl</span></a></span></span><span> </span><span id="local-6989586621681136182"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136182"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span>
</span><span id="line-271"></span><span>             </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681136180"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681136180"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681136179"><span class="annot"><span class="annottext">decl :: ImportDecl GhcPs
</span><a href="#local-6989586621681136179"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclExt :: forall pass. ImportDecl pass -&gt; XCImportDecl pass
</span><a href="GHC.Hs.ImpExp.html#ideclExt"><span class="hs-identifier hs-var">ideclExt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136176"><span class="annot"><span class="annottext">XCImportDecl GhcPs
</span><a href="#local-6989586621681136176"><span class="hs-identifier hs-var">noExtField</span></a></span></span><span>
</span><span id="line-272"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclName :: forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var">ideclName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136174"><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621681136174"><span class="hs-identifier hs-var">loc_imp_mod_name</span></a></span></span><span>
</span><span id="line-273"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclPkgQual :: forall pass. ImportDecl pass -&gt; Maybe StringLiteral
</span><a href="GHC.Hs.ImpExp.html#ideclPkgQual"><span class="hs-identifier hs-var">ideclPkgQual</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136172"><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681136172"><span class="hs-identifier hs-var">mb_pkg</span></a></span></span><span>
</span><span id="line-274"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclSource :: forall pass. ImportDecl pass -&gt; IsBootInterface
</span><a href="GHC.Hs.ImpExp.html#ideclSource"><span class="hs-identifier hs-var">ideclSource</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136171"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681136171"><span class="hs-identifier hs-var">want_boot</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclSafe :: forall pass. ImportDecl pass -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#ideclSafe"><span class="hs-identifier hs-var">ideclSafe</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136169"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136169"><span class="hs-identifier hs-var">mod_safe</span></a></span></span><span>
</span><span id="line-275"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclQualified :: forall pass. ImportDecl pass -&gt; ImportDeclQualifiedStyle
</span><a href="GHC.Hs.ImpExp.html#ideclQualified"><span class="hs-identifier hs-var">ideclQualified</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136167"><span class="annot"><span class="annottext">ImportDeclQualifiedStyle
</span><a href="#local-6989586621681136167"><span class="hs-identifier hs-var">qual_style</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclImplicit :: forall pass. ImportDecl pass -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#ideclImplicit"><span class="hs-identifier hs-var">ideclImplicit</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136165"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136165"><span class="hs-identifier hs-var">implicit</span></a></span></span><span>
</span><span id="line-276"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclAs :: forall pass. ImportDecl pass -&gt; Maybe (Located ModuleName)
</span><a href="GHC.Hs.ImpExp.html#ideclAs"><span class="hs-identifier hs-var">ideclAs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136163"><span class="annot"><span class="annottext">Maybe (Located ModuleName)
</span><a href="#local-6989586621681136163"><span class="hs-identifier hs-var">as_mod</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclHiding :: forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var">ideclHiding</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681136161"><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
</span><a href="#local-6989586621681136161"><span class="hs-identifier hs-var">imp_details</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681136180"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
 -&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool))
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
-&gt; TcRn (LImportDecl GhcRn, GlobalRdrEnv, ImportAvails, Bool)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>    </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe StringLiteral -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681136172"><span class="hs-identifier hs-var">mb_pkg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-280"></span><span>        </span><span id="local-6989586621681136157"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136157"><span class="hs-identifier hs-var">pkg_imports</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. Extension -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier hs-var">xoptM</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#PackageImports"><span class="hs-identifier hs-var">LangExt.PackageImports</span></a></span><span>
</span><span id="line-281"></span><span>        </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136157"><span class="hs-identifier hs-var">pkg_imports</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Rename.Names.html#packageImportErr"><span class="hs-identifier hs-var">packageImportErr</span></a></span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681136151"><span class="annot"><span class="annottext">qual_only :: Bool
</span><a href="#local-6989586621681136151"><span class="hs-identifier hs-var hs-var">qual_only</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportDeclQualifiedStyle -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#isImportDeclQualified"><span class="hs-identifier hs-var">isImportDeclQualified</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDeclQualifiedStyle
</span><a href="#local-6989586621681136167"><span class="hs-identifier hs-var">qual_style</span></a></span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span>    </span><span class="hs-comment">-- If there's an error in loadInterface, (e.g. interface</span><span>
</span><span id="line-286"></span><span>    </span><span class="hs-comment">-- file not found) we get lots of spurious errors from 'filterImports'</span><span>
</span><span id="line-287"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681136149"><span class="annot"><span class="annottext">imp_mod_name :: ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var hs-var">imp_mod_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621681136174"><span class="hs-identifier hs-var">loc_imp_mod_name</span></a></span><span>
</span><span id="line-288"></span><span>        </span><span id="local-6989586621681136148"><span class="annot"><span class="annottext">doc :: MsgDoc
</span><a href="#local-6989586621681136148"><span class="hs-identifier hs-var hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var">imp_mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is directly imported&quot;</span></span><span>
</span><span id="line-289"></span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-comment">-- Check for self-import, which confuses the typechecker (#9032)</span><span>
</span><span id="line-291"></span><span>    </span><span class="hs-comment">-- ghc --make rejects self-import cycles already, but batch-mode may not</span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-comment">-- at least not until GHC.IfaceToCore.tcHiBootIface, which is too late to avoid</span><span>
</span><span id="line-293"></span><span>    </span><span class="hs-comment">-- typechecker crashes.  (Indirect self imports are not caught until</span><span>
</span><span id="line-294"></span><span>    </span><span class="hs-comment">-- GHC.IfaceToCore, see #10337 tracking how to make this error better.)</span><span>
</span><span id="line-295"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-296"></span><span>    </span><span class="hs-comment">-- Originally, we also allowed 'import {-# SOURCE #-} M', but this</span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-comment">-- caused bug #10182: in one-shot mode, we should never load an hs-boot</span><span>
</span><span id="line-298"></span><span>    </span><span class="hs-comment">-- file for the module we are compiling into the EPS.  In principle,</span><span>
</span><span id="line-299"></span><span>    </span><span class="hs-comment">-- it should be possible to support this mode of use, but we would have to</span><span>
</span><span id="line-300"></span><span>    </span><span class="hs-comment">-- extend Provenance to support a local definition in a qualified location.</span><span>
</span><span id="line-301"></span><span>    </span><span class="hs-comment">-- For now, we don't support it, but see #10336</span><span>
</span><span id="line-302"></span><span>    </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var">imp_mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136182"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-303"></span><span>          </span><span class="hs-special">(</span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681136172"><span class="hs-identifier hs-var">mb_pkg</span></a></span><span> </span><span class="hs-keyword">of</span><span>  </span><span class="hs-comment">-- If we have import &quot;&lt;pkg&gt;&quot; M, then we should</span><span>
</span><span id="line-304"></span><span>                           </span><span class="hs-comment">-- check that &quot;&lt;pkg&gt;&quot; is &quot;this&quot; (which is magic)</span><span>
</span><span id="line-305"></span><span>                           </span><span class="hs-comment">-- or the name of this_mod's package.  Yurgh!</span><span>
</span><span id="line-306"></span><span>                           </span><span class="hs-comment">-- c.f. GHC.findModule, and #9997</span><span>
</span><span id="line-307"></span><span>             </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-308"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#StringLiteral"><span class="hs-identifier hs-type">StringLiteral</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681136141"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681136141"><span class="hs-identifier hs-var">pkg_fs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681136141"><span class="hs-identifier hs-var">pkg_fs</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; FastString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;this&quot;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span>
</span><span id="line-309"></span><span>                            </span><span class="annot"><span class="annottext">FastString -&gt; Unit
</span><a href="GHC.Unit.Types.html#fsToUnit"><span class="hs-identifier hs-var">fsToUnit</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681136141"><span class="hs-identifier hs-var">pkg_fs</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; Unit -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Unit
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136182"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-310"></span><span>         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A module cannot import itself:&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var">imp_mod_name</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span>
</span><span id="line-312"></span><span>    </span><span class="hs-comment">-- Check for a missing import list (Opt_WarnMissingImportList also</span><span>
</span><span id="line-313"></span><span>    </span><span class="hs-comment">-- checks for T(..) items but that is done in checkDodgyImport below)</span><span>
</span><span id="line-314"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
</span><a href="#local-6989586621681136161"><span class="hs-identifier hs-var">imp_details</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-315"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located [LIE GhcPs]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Explicit import list</span><span>
</span><span id="line-316"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136165"><span class="hs-identifier hs-var">implicit</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Do not bleat for implicit imports</span><span>
</span><span id="line-317"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136151"><span class="hs-identifier hs-var">qual_only</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingImportList"><span class="hs-identifier hs-var">Opt_WarnMissingImportList</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-319"></span><span>                           </span><span class="annot"><span class="annottext">WarnReason -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarn"><span class="hs-identifier hs-var">addWarn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingImportList"><span class="hs-identifier hs-var">Opt_WarnMissingImportList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#missingImportListWarn"><span class="hs-identifier hs-var">missingImportListWarn</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var">imp_mod_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span>    </span><span id="local-6989586621681136132"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136132"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MsgDoc
-&gt; ModuleName
-&gt; IsBootInterface
-&gt; Maybe FastString
-&gt; RnM ModIface
</span><a href="GHC.Iface.Load.html#loadSrcInterface"><span class="hs-identifier hs-var">loadSrcInterface</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681136148"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136149"><span class="hs-identifier hs-var">imp_mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681136171"><span class="hs-identifier hs-var">want_boot</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString)
-&gt; Maybe StringLiteral -&gt; Maybe FastString
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681136172"><span class="hs-identifier hs-var">mb_pkg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span>    </span><span class="hs-comment">-- Compiler sanity check: if the import didn't say</span><span>
</span><span id="line-325"></span><span>    </span><span class="hs-comment">-- {-# SOURCE #-} we should not get a hi-boot file</span><span>
</span><span id="line-326"></span><span>    </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">want_boot</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">NotBoot</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mi_boot</span><span> </span><span class="hs-identifier">iface</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">IsBoot</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">imp_mod_name</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span>    </span><span class="hs-comment">-- Issue a user warning for a redundant {- SOURCE -} import</span><span>
</span><span id="line-329"></span><span>    </span><span class="hs-comment">-- NB that we arrange to read all the ordinary imports before</span><span>
</span><span id="line-330"></span><span>    </span><span class="hs-comment">-- any of the {- SOURCE -} imports.</span><span>
</span><span id="line-331"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-332"></span><span>    </span><span class="hs-comment">-- in --make and GHCi, the compilation manager checks for this,</span><span>
</span><span id="line-333"></span><span>    </span><span class="hs-comment">-- and indeed we shouldn't do it here because the existence of</span><span>
</span><span id="line-334"></span><span>    </span><span class="hs-comment">-- the non-boot module depends on the compilation order, which</span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-comment">-- is not deterministic.  The hs-boot test can show this up.</span><span>
</span><span id="line-336"></span><span>    </span><span class="hs-identifier">dflags</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">getDynFlags</span><span>
</span><span id="line-337"></span><span>    </span><span class="hs-identifier">warnIf</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier">want_boot</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">IsBoot</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mi_boot</span><span> </span><span class="hs-identifier">iface</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">NotBoot</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">isOneShot</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ghcMode</span><span> </span><span class="hs-identifier">dflags</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>           </span><span class="hs-special">(</span><span class="hs-identifier">warnRedundantSourceImport</span><span> </span><span class="hs-identifier">imp_mod_name</span><span class="hs-special">)</span><span>
</span><span id="line-339"></span><span>    </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mod_safe</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">safeImportsOn</span><span> </span><span class="hs-identifier">dflags</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-identifier">addErr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;safe import can't be used as Safe Haskell isn't on!&quot;</span><span>
</span><span id="line-341"></span><span>                </span><span class="hs-operator">$+$</span><span> </span><span class="hs-identifier">ptext</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">sLit</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-string">&quot;please enable Safe Haskell through either &quot;</span><span>
</span><span id="line-342"></span><span>                                   </span><span class="hs-operator">++</span><span> </span><span class="hs-string">&quot;Safe, Trustworthy or Unsafe&quot;</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-345"></span><span>        </span><span class="hs-identifier">qual_mod_name</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fmap</span><span> </span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">as_mod</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">orElse</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">imp_mod_name</span><span>
</span><span id="line-346"></span><span>        </span><span class="hs-identifier">imp_spec</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ImpDeclSpec</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">is_mod</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">imp_mod_name</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">is_qual</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">qual_only</span><span class="hs-special">,</span><span>
</span><span id="line-347"></span><span>                                  </span><span class="hs-identifier">is_dloc</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">loc</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">is_as</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">qual_mod_name</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span>    </span><span class="hs-comment">-- filter the imports according to the import declaration</span><span>
</span><span id="line-350"></span><span>    </span><span class="hs-special">(</span><span class="hs-identifier">new_imp_details</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gres</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">filterImports</span><span> </span><span class="hs-identifier">iface</span><span> </span><span class="hs-identifier">imp_spec</span><span> </span><span class="hs-identifier">imp_details</span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-comment">-- for certain error messages, we&#8217;d like to know what could be imported</span><span>
</span><span id="line-353"></span><span>    </span><span class="hs-comment">-- here, if everything were imported</span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-identifier">potential_gres</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mkGlobalRdrEnv</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">snd</span><span> </span><span class="hs-operator">&lt;$&gt;</span><span> </span><span class="hs-identifier">filterImports</span><span> </span><span class="hs-identifier">iface</span><span> </span><span class="hs-identifier">imp_spec</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">gbl_env</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">mkGlobalRdrEnv</span><span> </span><span class="hs-identifier">gres</span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span>        </span><span class="hs-identifier">is_hiding</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">Just</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">True</span><span class="hs-special">,</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">imp_details</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">True</span><span>
</span><span id="line-359"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span>        </span><span class="hs-comment">-- should the import be safe?</span><span>
</span><span id="line-362"></span><span>        </span><span class="hs-identifier">mod_safe'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">mod_safe</span><span>
</span><span id="line-363"></span><span>                    </span><span class="hs-operator">||</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-identifier">implicit</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">safeDirectImpsReq</span><span> </span><span class="hs-identifier">dflags</span><span class="hs-special">)</span><span>
</span><span id="line-364"></span><span>                    </span><span class="hs-operator">||</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">implicit</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">safeImplicitImpsReq</span><span> </span><span class="hs-identifier">dflags</span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">imv</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ImportedModsVal</span><span>
</span><span id="line-367"></span><span>            </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">imv_name</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">qual_mod_name</span><span>
</span><span id="line-368"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imv_span</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">loc</span><span>
</span><span id="line-369"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imv_is_safe</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">mod_safe'</span><span>
</span><span id="line-370"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imv_is_hiding</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">is_hiding</span><span>
</span><span id="line-371"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imv_all_exports</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">potential_gres</span><span>
</span><span id="line-372"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imv_qualified</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">qual_only</span><span>
</span><span id="line-373"></span><span>            </span><span class="hs-special">}</span><span>
</span><span id="line-374"></span><span>        </span><span class="hs-identifier">imports</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">calculateAvails</span><span> </span><span class="hs-identifier">dflags</span><span> </span><span class="hs-identifier">iface</span><span> </span><span class="hs-identifier">mod_safe'</span><span> </span><span class="hs-identifier">want_boot</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ImportedByUser</span><span> </span><span class="hs-identifier">imv</span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span>    </span><span class="hs-comment">-- Complain if we import a deprecated module</span><span>
</span><span id="line-377"></span><span>    </span><span class="hs-identifier">whenWOptM</span><span> </span><span class="hs-identifier">Opt_WarnWarningsDeprecations</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-378"></span><span>       </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mi_warns</span><span> </span><span class="hs-identifier">iface</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-379"></span><span>          </span><span class="hs-identifier">WarnAll</span><span> </span><span class="hs-identifier">txt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">addWarn</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Reason</span><span> </span><span class="hs-identifier">Opt_WarnWarningsDeprecations</span><span class="hs-special">)</span><span>
</span><span id="line-380"></span><span>                                </span><span class="hs-special">(</span><span class="hs-identifier">moduleWarn</span><span> </span><span class="hs-identifier">imp_mod_name</span><span> </span><span class="hs-identifier">txt</span><span class="hs-special">)</span><span>
</span><span id="line-381"></span><span>          </span><span class="hs-identifier">_</span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-382"></span><span>     </span><span class="hs-special">)</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span>    </span><span class="hs-comment">-- Complain about -Wcompat-unqualified-imports violations.</span><span>
</span><span id="line-385"></span><span>    </span><span class="hs-identifier">warnUnqualifiedImport</span><span> </span><span class="hs-identifier">decl</span><span> </span><span class="hs-identifier">iface</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">new_imp_decl</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">L</span><span> </span><span class="hs-identifier">loc</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">decl</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">ideclExt</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">noExtField</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ideclSafe</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">mod_safe'</span><span>
</span><span id="line-388"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ideclHiding</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">new_imp_details</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-389"></span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">new_imp_decl</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gbl_env</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">imports</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mi_hpc</span><span> </span><span class="hs-identifier">iface</span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="hs-comment">-- | Calculate the 'ImportAvails' induced by an import of a particular</span><span>
</span><span id="line-393"></span><span class="hs-comment">-- interface, but without 'imp_mods'.</span><span>
</span><span id="line-394"></span><span class="annot"><a href="GHC.Rename.Names.html#calculateAvails"><span class="hs-identifier hs-type">calculateAvails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-395"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span>
</span><span id="line-396"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#IsSafeImport"><span class="hs-identifier hs-type">IsSafeImport</span></a></span><span>
</span><span id="line-397"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#IsBootInterface"><span class="hs-identifier hs-type">IsBootInterface</span></a></span><span>
</span><span id="line-398"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ImportedBy"><span class="hs-identifier hs-type">ImportedBy</span></a></span><span>
</span><span id="line-399"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span>
</span><span id="line-400"></span><span id="calculateAvails"><span class="annot"><span class="annottext">calculateAvails :: DynFlags
-&gt; ModIface
-&gt; Bool
-&gt; IsBootInterface
-&gt; ImportedBy
-&gt; ImportAvails
</span><a href="GHC.Rename.Names.html#calculateAvails"><span class="hs-identifier hs-var hs-var">calculateAvails</span></a></span></span><span> </span><span id="local-6989586621681136078"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681136078"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681136077"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681136076"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136076"><span class="hs-identifier hs-var">mod_safe'</span></a></span></span><span> </span><span id="local-6989586621681136075"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681136075"><span class="hs-identifier hs-var">want_boot</span></a></span></span><span> </span><span id="local-6989586621681136074"><span class="annot"><span class="annottext">ImportedBy
</span><a href="#local-6989586621681136074"><span class="hs-identifier hs-var">imported_by</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681136073"><span class="annot"><span class="annottext">imp_mod :: Module
</span><a href="#local-6989586621681136073"><span class="hs-identifier hs-var hs-var">imp_mod</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-402"></span><span>      </span><span id="local-6989586621681136071"><span class="annot"><span class="annottext">imp_sem_mod :: Module
</span><a href="#local-6989586621681136071"><span class="hs-identifier hs-var hs-var">imp_sem_mod</span></a></span></span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_semantic_module"><span class="hs-identifier hs-var">mi_semantic_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-403"></span><span>      </span><span id="local-6989586621681136069"><span class="annot"><span class="annottext">orph_iface :: Bool
</span><a href="#local-6989586621681136069"><span class="hs-identifier hs-var hs-var">orph_iface</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIfaceBackend -&gt; Bool
</span><a href="GHC.Driver.Types.html#mi_orphan"><span class="hs-identifier hs-var hs-var">mi_orphan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IfaceBackendExts 'ModIfaceFinal
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; IfaceBackendExts phase
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var hs-var">mi_final_exts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-404"></span><span>      </span><span id="local-6989586621681136066"><span class="annot"><span class="annottext">has_finsts :: Bool
</span><a href="#local-6989586621681136066"><span class="hs-identifier hs-var hs-var">has_finsts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIfaceBackend -&gt; Bool
</span><a href="GHC.Driver.Types.html#mi_finsts"><span class="hs-identifier hs-var hs-var">mi_finsts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IfaceBackendExts 'ModIfaceFinal
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; IfaceBackendExts phase
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var hs-var">mi_final_exts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-405"></span><span>      </span><span id="local-6989586621681136064"><span class="annot"><span class="annottext">deps :: Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var hs-var">deps</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Dependencies
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Dependencies
</span><a href="GHC.Driver.Types.html#mi_deps"><span class="hs-identifier hs-var hs-var">mi_deps</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-406"></span><span>      </span><span id="local-6989586621681136062"><span class="annot"><span class="annottext">trust :: SafeHaskellMode
</span><a href="#local-6989586621681136062"><span class="hs-identifier hs-var hs-var">trust</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IfaceTrustInfo -&gt; SafeHaskellMode
</span><a href="GHC.Driver.Types.html#getSafeMode"><span class="hs-identifier hs-var">getSafeMode</span></a></span><span> </span><span class="annot"><span class="annottext">(IfaceTrustInfo -&gt; SafeHaskellMode)
-&gt; IfaceTrustInfo -&gt; SafeHaskellMode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; IfaceTrustInfo
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; IfaceTrustInfo
</span><a href="GHC.Driver.Types.html#mi_trust"><span class="hs-identifier hs-var hs-var">mi_trust</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-407"></span><span>      </span><span id="local-6989586621681136059"><span class="annot"><span class="annottext">trust_pkg :: Bool
</span><a href="#local-6989586621681136059"><span class="hs-identifier hs-var hs-var">trust_pkg</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Bool
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Bool
</span><a href="GHC.Driver.Types.html#mi_trust_pkg"><span class="hs-identifier hs-var hs-var">mi_trust_pkg</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-408"></span><span>
</span><span id="line-409"></span><span>      </span><span class="hs-comment">-- If the module exports anything defined in this module, just</span><span>
</span><span id="line-410"></span><span>      </span><span class="hs-comment">-- ignore it.  Reason: otherwise it looks as if there are two</span><span>
</span><span id="line-411"></span><span>      </span><span class="hs-comment">-- local definition sites for the thing, and an error gets</span><span>
</span><span id="line-412"></span><span>      </span><span class="hs-comment">-- reported.  Easiest thing is just to filter them out up</span><span>
</span><span id="line-413"></span><span>      </span><span class="hs-comment">-- front. This situation only arises if a module imports</span><span>
</span><span id="line-414"></span><span>      </span><span class="hs-comment">-- itself, or another module that imported it.  (Necessarily,</span><span>
</span><span id="line-415"></span><span>      </span><span class="hs-comment">-- this involves a loop.)</span><span>
</span><span id="line-416"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-417"></span><span>      </span><span class="hs-comment">-- We do this *after* filterImports, so that if you say</span><span>
</span><span id="line-418"></span><span>      </span><span class="hs-comment">--      module A where</span><span>
</span><span id="line-419"></span><span>      </span><span class="hs-comment">--         import B( AType )</span><span>
</span><span id="line-420"></span><span>      </span><span class="hs-comment">--         type AType = ...</span><span>
</span><span id="line-421"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-422"></span><span>      </span><span class="hs-comment">--      module B( AType ) where</span><span>
</span><span id="line-423"></span><span>      </span><span class="hs-comment">--         import {-# SOURCE #-} A( AType )</span><span>
</span><span id="line-424"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-425"></span><span>      </span><span class="hs-comment">-- then you won't get a 'B does not export AType' message.</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span>      </span><span class="hs-comment">-- Compute new transitive dependencies</span><span>
</span><span id="line-429"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-430"></span><span>      </span><span class="hs-comment">-- 'dep_orphs' and 'dep_finsts' do NOT include the imported module</span><span>
</span><span id="line-431"></span><span>      </span><span class="hs-comment">-- itself, but we DO need to include this module in 'imp_orphs' and</span><span>
</span><span id="line-432"></span><span>      </span><span class="hs-comment">-- 'imp_finsts' if it defines an orphan or instance family; thus the</span><span>
</span><span id="line-433"></span><span>      </span><span class="hs-comment">-- orph_iface/has_iface tests.</span><span>
</span><span id="line-434"></span><span>
</span><span id="line-435"></span><span>      </span><span id="local-6989586621681136057"><span class="annot"><span class="annottext">orphans :: [Module]
</span><a href="#local-6989586621681136057"><span class="hs-identifier hs-var hs-var">orphans</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136069"><span class="hs-identifier hs-var">orph_iface</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">imp_sem_mod</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">elem</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">dep_orphs</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">imp_sem_mod</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">dep_orphs</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-436"></span><span>                             </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136071"><span class="hs-identifier hs-var">imp_sem_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; [Module] -&gt; [Module]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [Module]
</span><a href="GHC.Driver.Types.html#dep_orphs"><span class="hs-identifier hs-var hs-var">dep_orphs</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-437"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [Module]
</span><a href="GHC.Driver.Types.html#dep_orphs"><span class="hs-identifier hs-var hs-var">dep_orphs</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span>      </span><span id="local-6989586621681136052"><span class="annot"><span class="annottext">finsts :: [Module]
</span><a href="#local-6989586621681136052"><span class="hs-identifier hs-var hs-var">finsts</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136066"><span class="hs-identifier hs-var">has_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">imp_sem_mod</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">elem</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">dep_finsts</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">imp_sem_mod</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">dep_orphs</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span>                            </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136071"><span class="hs-identifier hs-var">imp_sem_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; [Module] -&gt; [Module]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [Module]
</span><a href="GHC.Driver.Types.html#dep_finsts"><span class="hs-identifier hs-var hs-var">dep_finsts</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-441"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [Module]
</span><a href="GHC.Driver.Types.html#dep_finsts"><span class="hs-identifier hs-var hs-var">dep_finsts</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span>      </span><span id="local-6989586621681136050"><span class="annot"><span class="annottext">pkg :: Unit
</span><a href="#local-6989586621681136050"><span class="hs-identifier hs-var hs-var">pkg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; Unit
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-444"></span><span>      </span><span id="local-6989586621681136049"><span class="annot"><span class="annottext">ipkg :: UnitId
</span><a href="#local-6989586621681136049"><span class="hs-identifier hs-var hs-var">ipkg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unit -&gt; UnitId
</span><a href="GHC.Unit.Types.html#toUnitId"><span class="hs-identifier hs-var">toUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681136050"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-445"></span><span>
</span><span id="line-446"></span><span>      </span><span class="hs-comment">-- Does this import mean we now require our own pkg</span><span>
</span><span id="line-447"></span><span>      </span><span class="hs-comment">-- to be trusted? See Note [Trust Own Package]</span><span>
</span><span id="line-448"></span><span>      </span><span id="local-6989586621681136047"><span class="annot"><span class="annottext">ptrust :: Bool
</span><a href="#local-6989586621681136047"><span class="hs-identifier hs-var hs-var">ptrust</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SafeHaskellMode
</span><a href="#local-6989586621681136062"><span class="hs-identifier hs-var">trust</span></a></span><span> </span><span class="annot"><span class="annottext">SafeHaskellMode -&gt; SafeHaskellMode -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">SafeHaskellMode
</span><a href="GHC.Driver.Session.html#Sf_Trustworthy"><span class="hs-identifier hs-var">Sf_Trustworthy</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136059"><span class="hs-identifier hs-var">trust_pkg</span></a></span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681136045"><span class="annot"><span class="annottext">[GenWithIsBoot ModuleName]
</span><a href="#local-6989586621681136045"><span class="hs-identifier hs-var">dependent_mods</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136044"><span class="annot"><span class="annottext">[(UnitId, Bool)]
</span><a href="#local-6989586621681136044"><span class="hs-identifier hs-var">dependent_pkgs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136043"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136043"><span class="hs-identifier hs-var">pkg_trust_req</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-451"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681136050"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; Unit -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Unit
</span><a href="GHC.Driver.Session.html#homeUnit"><span class="hs-identifier hs-var">homeUnit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681136078"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-452"></span><span>            </span><span class="hs-comment">-- Imported module is from the home package</span><span>
</span><span id="line-453"></span><span>            </span><span class="hs-comment">-- Take its dependent modules and add imp_mod itself</span><span>
</span><span id="line-454"></span><span>            </span><span class="hs-comment">-- Take its dependent packages unchanged</span><span>
</span><span id="line-455"></span><span>            </span><span class="hs-comment">--</span><span>
</span><span id="line-456"></span><span>            </span><span class="hs-comment">-- NB: (dep_mods deps) might include a hi-boot file</span><span>
</span><span id="line-457"></span><span>            </span><span class="hs-comment">-- for the module being compiled, CM. Do *not* filter</span><span>
</span><span id="line-458"></span><span>            </span><span class="hs-comment">-- this out (as we used to), because when we've</span><span>
</span><span id="line-459"></span><span>            </span><span class="hs-comment">-- finished dealing with the direct imports we want to</span><span>
</span><span id="line-460"></span><span>            </span><span class="hs-comment">-- know if any of them depended on CM.hi-boot, in</span><span>
</span><span id="line-461"></span><span>            </span><span class="hs-comment">-- which case we should do the hi-boot consistency</span><span>
</span><span id="line-462"></span><span>            </span><span class="hs-comment">-- check.  See GHC.Iface.Load.loadHiBootInterface</span><span>
</span><span id="line-463"></span><span>            </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">GWIB :: forall mod. mod -&gt; IsBootInterface -&gt; GenWithIsBoot mod
</span><a href="GHC.Unit.Types.html#GWIB"><span class="hs-identifier hs-type">GWIB</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">gwib_mod :: ModuleName
</span><a href="GHC.Unit.Types.html#gwib_mod"><span class="hs-identifier hs-var">gwib_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136073"><span class="hs-identifier hs-var">imp_mod</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">gwib_isBoot :: IsBootInterface
</span><a href="GHC.Unit.Types.html#gwib_isBoot"><span class="hs-identifier hs-var">gwib_isBoot</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681136075"><span class="hs-identifier hs-var">want_boot</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">GenWithIsBoot ModuleName
-&gt; [GenWithIsBoot ModuleName] -&gt; [GenWithIsBoot ModuleName]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [GenWithIsBoot ModuleName]
</span><a href="GHC.Driver.Types.html#dep_mods"><span class="hs-identifier hs-var hs-var">dep_mods</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-464"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [(UnitId, Bool)]
</span><a href="GHC.Driver.Types.html#dep_pkgs"><span class="hs-identifier hs-var hs-var">dep_pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-465"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136047"><span class="hs-identifier hs-var">ptrust</span></a></span><span>
</span><span id="line-466"></span><span>            </span><span class="hs-special">)</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-469"></span><span>            </span><span class="hs-comment">-- Imported module is from another package</span><span>
</span><span id="line-470"></span><span>            </span><span class="hs-comment">-- Dump the dependent modules</span><span>
</span><span id="line-471"></span><span>            </span><span class="hs-comment">-- Add the package imp_mod comes from to the dependent packages</span><span>
</span><span id="line-472"></span><span>            </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ipkg</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">elem</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">fst</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">dep_pkgs</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-473"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ipkg</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">dep_pkgs</span><span> </span><span class="hs-identifier">deps</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-474"></span><span>            </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681136049"><span class="hs-identifier hs-var">ipkg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(UnitId, Bool) -&gt; [(UnitId, Bool)] -&gt; [(UnitId, Bool)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [(UnitId, Bool)]
</span><a href="GHC.Driver.Types.html#dep_pkgs"><span class="hs-identifier hs-var hs-var">dep_pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681136064"><span class="hs-identifier hs-var">deps</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-475"></span><span>
</span><span id="line-476"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">ImportAvails :: ImportedMods
-&gt; ModuleNameEnv (GenWithIsBoot ModuleName)
-&gt; Set UnitId
-&gt; Set UnitId
-&gt; Bool
-&gt; [Module]
-&gt; [Module]
-&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#ImportAvails"><span class="hs-identifier hs-type">ImportAvails</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-477"></span><span>          </span><span class="annot"><span class="annottext">imp_mods :: ImportedMods
</span><a href="GHC.Tc.Types.html#imp_mods"><span class="hs-identifier hs-var">imp_mods</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; [ImportedBy] -&gt; ImportedMods
forall a. Module -&gt; a -&gt; ModuleEnv a
</span><a href="GHC.Unit.Module.Env.html#unitModuleEnv"><span class="hs-identifier hs-var">unitModuleEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136077"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ImportedBy
</span><a href="#local-6989586621681136074"><span class="hs-identifier hs-var">imported_by</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-478"></span><span>          </span><span class="annot"><span class="annottext">imp_orphs :: [Module]
</span><a href="GHC.Tc.Types.html#imp_orphs"><span class="hs-identifier hs-var">imp_orphs</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681136057"><span class="hs-identifier hs-var">orphans</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-479"></span><span>          </span><span class="annot"><span class="annottext">imp_finsts :: [Module]
</span><a href="GHC.Tc.Types.html#imp_finsts"><span class="hs-identifier hs-var">imp_finsts</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681136052"><span class="hs-identifier hs-var">finsts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-480"></span><span>          </span><span class="annot"><span class="annottext">imp_dep_mods :: ModuleNameEnv (GenWithIsBoot ModuleName)
</span><a href="GHC.Tc.Types.html#imp_dep_mods"><span class="hs-identifier hs-var">imp_dep_mods</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenWithIsBoot ModuleName]
-&gt; ModuleNameEnv (GenWithIsBoot ModuleName)
</span><a href="GHC.Tc.Types.html#mkModDeps"><span class="hs-identifier hs-var">mkModDeps</span></a></span><span> </span><span class="annot"><span class="annottext">[GenWithIsBoot ModuleName]
</span><a href="#local-6989586621681136045"><span class="hs-identifier hs-var">dependent_mods</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-481"></span><span>          </span><span class="annot"><span class="annottext">imp_dep_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_dep_pkgs"><span class="hs-identifier hs-var">imp_dep_pkgs</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; Set UnitId
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">S.fromList</span></a></span><span> </span><span class="annot"><span class="annottext">([UnitId] -&gt; Set UnitId)
-&gt; ([(UnitId, Bool)] -&gt; [UnitId]) -&gt; [(UnitId, Bool)] -&gt; Set UnitId
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((UnitId, Bool) -&gt; UnitId) -&gt; [(UnitId, Bool)] -&gt; [UnitId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(UnitId, Bool) -&gt; UnitId
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">([(UnitId, Bool)] -&gt; Set UnitId) -&gt; [(UnitId, Bool)] -&gt; Set UnitId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(UnitId, Bool)]
</span><a href="#local-6989586621681136044"><span class="hs-identifier hs-var">dependent_pkgs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-482"></span><span>          </span><span class="hs-comment">-- Add in the imported modules trusted package</span><span>
</span><span id="line-483"></span><span>          </span><span class="hs-comment">-- requirements. ONLY do this though if we import the</span><span>
</span><span id="line-484"></span><span>          </span><span class="hs-comment">-- module as a safe import.</span><span>
</span><span id="line-485"></span><span>          </span><span class="hs-comment">-- See Note [Tracking Trust Transitively]</span><span>
</span><span id="line-486"></span><span>          </span><span class="hs-comment">-- and Note [Trust Transitive Property]</span><span>
</span><span id="line-487"></span><span>          </span><span class="annot"><span class="annottext">imp_trust_pkgs :: Set UnitId
</span><a href="GHC.Tc.Types.html#imp_trust_pkgs"><span class="hs-identifier hs-var">imp_trust_pkgs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136076"><span class="hs-identifier hs-var">mod_safe'</span></a></span><span>
</span><span id="line-488"></span><span>                               </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; Set UnitId
forall a. Ord a =&gt; [a] -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#fromList"><span class="hs-identifier hs-var">S.fromList</span></a></span><span> </span><span class="annot"><span class="annottext">([UnitId] -&gt; Set UnitId)
-&gt; ([(UnitId, Bool)] -&gt; [UnitId]) -&gt; [(UnitId, Bool)] -&gt; Set UnitId
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((UnitId, Bool) -&gt; UnitId) -&gt; [(UnitId, Bool)] -&gt; [UnitId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(UnitId, Bool) -&gt; UnitId
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">([(UnitId, Bool)] -&gt; Set UnitId) -&gt; [(UnitId, Bool)] -&gt; Set UnitId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((UnitId, Bool) -&gt; Bool) -&gt; [(UnitId, Bool)] -&gt; [(UnitId, Bool)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">(UnitId, Bool) -&gt; Bool
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(UnitId, Bool)]
</span><a href="#local-6989586621681136044"><span class="hs-identifier hs-var">dependent_pkgs</span></a></span><span>
</span><span id="line-489"></span><span>                               </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Set UnitId
forall a. Set a
</span><a href="../../containers/src/Data.Set.Internal.html#empty"><span class="hs-identifier hs-var">S.empty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-490"></span><span>          </span><span class="hs-comment">-- Do we require our own pkg to be trusted?</span><span>
</span><span id="line-491"></span><span>          </span><span class="hs-comment">-- See Note [Trust Own Package]</span><span>
</span><span id="line-492"></span><span>          </span><span class="annot"><span class="annottext">imp_trust_own_pkg :: Bool
</span><a href="GHC.Tc.Types.html#imp_trust_own_pkg"><span class="hs-identifier hs-var">imp_trust_own_pkg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136043"><span class="hs-identifier hs-var">pkg_trust_req</span></a></span><span>
</span><span id="line-493"></span><span>     </span><span class="hs-special">}</span><span>
</span><span id="line-494"></span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span class="hs-comment">-- | Issue a warning if the user imports Data.List without either an import</span><span>
</span><span id="line-497"></span><span class="hs-comment">-- list or `qualified`. This is part of the migration plan for the</span><span>
</span><span id="line-498"></span><span class="hs-comment">-- `Data.List.singleton` proposal. See #17244.</span><span>
</span><span id="line-499"></span><span class="annot"><a href="GHC.Rename.Names.html#warnUnqualifiedImport"><span class="hs-identifier hs-type">warnUnqualifiedImport</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-500"></span><span id="warnUnqualifiedImport"><span class="annot"><span class="annottext">warnUnqualifiedImport :: ImportDecl GhcPs -&gt; ModIface -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnUnqualifiedImport"><span class="hs-identifier hs-var hs-var">warnUnqualifiedImport</span></a></span></span><span> </span><span id="local-6989586621681136025"><span class="annot"><span class="annottext">ImportDecl GhcPs
</span><a href="#local-6989586621681136025"><span class="hs-identifier hs-var">decl</span></a></span></span><span> </span><span id="local-6989586621681136024"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136024"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-501"></span><span>    </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnCompatUnqualifiedImports"><span class="hs-identifier hs-var">Opt_WarnCompatUnqualifiedImports</span></a></span><span>
</span><span id="line-502"></span><span>    </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136022"><span class="hs-identifier hs-var">bad_import</span></a></span><span>
</span><span id="line-503"></span><span>    </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnAt"><span class="hs-identifier hs-var">addWarnAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnCompatUnqualifiedImports"><span class="hs-identifier hs-var">Opt_WarnCompatUnqualifiedImports</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681136020"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681136019"><span class="hs-identifier hs-var">warning</span></a></span><span>
</span><span id="line-504"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-505"></span><span>    </span><span id="local-6989586621681136018"><span class="annot"><span class="annottext">mod :: Module
</span><a href="#local-6989586621681136018"><span class="hs-identifier hs-var hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681136024"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-506"></span><span>    </span><span id="local-6989586621681136020"><span class="annot"><span class="annottext">loc :: SrcSpan
</span><a href="#local-6989586621681136020"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">(Located ModuleName -&gt; SrcSpan) -&gt; Located ModuleName -&gt; SrcSpan
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs
</span><a href="#local-6989586621681136025"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span>    </span><span id="local-6989586621681136016"><span class="annot"><span class="annottext">is_qual :: Bool
</span><a href="#local-6989586621681136016"><span class="hs-identifier hs-var hs-var">is_qual</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportDeclQualifiedStyle -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#isImportDeclQualified"><span class="hs-identifier hs-var">isImportDeclQualified</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; ImportDeclQualifiedStyle
forall pass. ImportDecl pass -&gt; ImportDeclQualifiedStyle
</span><a href="GHC.Hs.ImpExp.html#ideclQualified"><span class="hs-identifier hs-var hs-var">ideclQualified</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs
</span><a href="#local-6989586621681136025"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-509"></span><span>    </span><span id="local-6989586621681136015"><span class="annot"><span class="annottext">has_import_list :: Bool
</span><a href="#local-6989586621681136015"><span class="hs-identifier hs-var hs-var">has_import_list</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-510"></span><span>      </span><span class="hs-comment">-- We treat a `hiding` clause as not having an import list although</span><span>
</span><span id="line-511"></span><span>      </span><span class="hs-comment">-- it's not entirely clear this is the right choice.</span><span>
</span><span id="line-512"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; Maybe (Bool, Located [LIE GhcPs])
forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var hs-var">ideclHiding</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs
</span><a href="#local-6989586621681136025"><span class="hs-identifier hs-var">decl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-513"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located [LIE GhcPs]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-514"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-515"></span><span>    </span><span id="local-6989586621681136022"><span class="annot"><span class="annottext">bad_import :: Bool
</span><a href="#local-6989586621681136022"><span class="hs-identifier hs-var hs-var">bad_import</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-516"></span><span>      </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681136018"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleSet -&gt; Bool
</span><a href="GHC.Unit.Module.Env.html#elemModuleSet"><span class="hs-operator hs-var">`elemModuleSet`</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681136013"><span class="hs-identifier hs-var">qualifiedMods</span></a></span><span>
</span><span id="line-517"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136016"><span class="hs-identifier hs-var">is_qual</span></a></span><span>
</span><span id="line-518"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681136015"><span class="hs-identifier hs-var">has_import_list</span></a></span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span>    </span><span id="local-6989586621681136019"><span class="annot"><span class="annottext">warning :: MsgDoc
</span><a href="#local-6989586621681136019"><span class="hs-identifier hs-var hs-var">warning</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-521"></span><span>      </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;To ensure compatibility with future core libraries changes&quot;</span></span><span>
</span><span id="line-522"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;imports to&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs
</span><a href="#local-6989586621681136025"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;should be&quot;</span></span><span>
</span><span id="line-523"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;either qualified or have an explicit import list.&quot;</span></span><span>
</span><span id="line-524"></span><span>      </span><span class="hs-special">]</span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span>    </span><span class="hs-comment">-- Modules for which we warn if we see unqualified imports</span><span>
</span><span id="line-527"></span><span>    </span><span id="local-6989586621681136013"><span class="annot"><span class="annottext">qualifiedMods :: ModuleSet
</span><a href="#local-6989586621681136013"><span class="hs-identifier hs-var hs-var">qualifiedMods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; ModuleSet
</span><a href="GHC.Unit.Module.Env.html#mkModuleSet"><span class="hs-identifier hs-var">mkModuleSet</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="GHC.Builtin.Names.html#dATA_LIST"><span class="hs-identifier hs-var">dATA_LIST</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span class="annot"><a href="GHC.Rename.Names.html#warnRedundantSourceImport"><span class="hs-identifier hs-type">warnRedundantSourceImport</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-531"></span><span id="warnRedundantSourceImport"><span class="annot"><span class="annottext">warnRedundantSourceImport :: ModuleName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#warnRedundantSourceImport"><span class="hs-identifier hs-var hs-var">warnRedundantSourceImport</span></a></span></span><span> </span><span id="local-6989586621681136008"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136008"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span>
</span><span id="line-532"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Unnecessary {-# SOURCE #-} in the import of module&quot;</span></span><span>
</span><span id="line-533"></span><span>          </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681136008"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{importsFromLocalDecls}
*                                                                      *
************************************************************************

From the top-level declarations of this module produce
        * the lexical environment
        * the ImportAvails
created by its bindings.

Note [Top-level Names in Template Haskell decl quotes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See also: Note [Interactively-bound Ids in GHCi] in GHC.Driver.Types
          Note [Looking up Exact RdrNames] in GHC.Rename.Env

Consider a Template Haskell declaration quotation like this:
      module M where
        f x = h [d| f = 3 |]
When renaming the declarations inside [d| ...|], we treat the
top level binders specially in two ways

1.  We give them an Internal Name, not (as usual) an External one.
    This is done by GHC.Rename.Env.newTopSrcBinder.

2.  We make them *shadow* the outer bindings.
    See Note [GlobalRdrEnv shadowing]

3. We find out whether we are inside a [d| ... |] by testing the TH
   stage. This is a slight hack, because the stage field was really
   meant for the type checker, and here we are not interested in the
   fields of Brack, hence the error thunks in thRnBrack.
-}</span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.Rename.Names.html#extendGlobalRdrEnvRn"><span class="hs-identifier hs-type">extendGlobalRdrEnvRn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-571"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Fixity.html#MiniFixityEnv"><span class="hs-identifier hs-type">MiniFixityEnv</span></a></span><span>
</span><span id="line-572"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- Updates both the GlobalRdrEnv and the FixityEnv</span><span>
</span><span id="line-574"></span><span class="hs-comment">-- We return a new TcLclEnv only because we might have to</span><span>
</span><span id="line-575"></span><span class="hs-comment">-- delete some bindings from it;</span><span>
</span><span id="line-576"></span><span class="hs-comment">-- see Note [Top-level Names in Template Haskell decl quotes]</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span id="extendGlobalRdrEnvRn"><span class="annot"><span class="annottext">extendGlobalRdrEnvRn :: [AvailInfo] -&gt; MiniFixityEnv -&gt; RnM (TcGblEnv, TcLclEnv)
</span><a href="GHC.Rename.Names.html#extendGlobalRdrEnvRn"><span class="hs-identifier hs-var hs-var">extendGlobalRdrEnvRn</span></a></span></span><span> </span><span id="local-6989586621681136006"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681136006"><span class="hs-identifier hs-var">avails</span></a></span></span><span> </span><span id="local-6989586621681136005"><span class="annot"><span class="annottext">MiniFixityEnv
</span><a href="#local-6989586621681136005"><span class="hs-identifier hs-var">new_fixities</span></a></span></span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681136004"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136004"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681136003"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681136003"><span class="hs-identifier hs-var">lcl_env</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RnM (TcGblEnv, TcLclEnv)
forall gbl lcl. TcRnIf gbl lcl (gbl, lcl)
</span><a href="GHC.Tc.Utils.Monad.html#getEnvs"><span class="hs-identifier hs-var">getEnvs</span></a></span><span>
</span><span id="line-580"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681136001"><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621681136001"><span class="hs-identifier hs-var">stage</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM ThStage
</span><a href="GHC.Tc.Utils.Monad.html#getStage"><span class="hs-identifier hs-var">getStage</span></a></span><span>
</span><span id="line-581"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135999"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135999"><span class="hs-identifier hs-var">isGHCi</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv Bool
</span><a href="GHC.Tc.Utils.Monad.html#getIsGHCi"><span class="hs-identifier hs-var">getIsGHCi</span></a></span><span>
</span><span id="line-582"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135997"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681135997"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136004"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-583"></span><span>              </span><span id="local-6989586621681135995"><span class="annot"><span class="annottext">fix_env :: FixityEnv
</span><a href="#local-6989586621681135995"><span class="hs-identifier hs-var hs-var">fix_env</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; FixityEnv
</span><a href="GHC.Tc.Types.html#tcg_fix_env"><span class="hs-identifier hs-var hs-var">tcg_fix_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136004"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-584"></span><span>              </span><span id="local-6989586621681135993"><span class="annot"><span class="annottext">th_bndrs :: ThBindEnv
</span><a href="#local-6989586621681135993"><span class="hs-identifier hs-var hs-var">th_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; ThBindEnv
</span><a href="GHC.Tc.Types.html#tcl_th_bndrs"><span class="hs-identifier hs-var hs-var">tcl_th_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681136003"><span class="hs-identifier hs-var">lcl_env</span></a></span><span>
</span><span id="line-585"></span><span>              </span><span id="local-6989586621681135991"><span class="annot"><span class="annottext">th_lvl :: Int
</span><a href="#local-6989586621681135991"><span class="hs-identifier hs-var hs-var">th_lvl</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThStage -&gt; Int
</span><a href="GHC.Tc.Types.html#thLevel"><span class="hs-identifier hs-var">thLevel</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621681136001"><span class="hs-identifier hs-var">stage</span></a></span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span>              </span><span class="hs-comment">-- Delete new_occs from global and local envs</span><span>
</span><span id="line-588"></span><span>              </span><span class="hs-comment">-- If we are in a TemplateHaskell decl bracket,</span><span>
</span><span id="line-589"></span><span>              </span><span class="hs-comment">--    we are going to shadow them</span><span>
</span><span id="line-590"></span><span>              </span><span class="hs-comment">-- See Note [GlobalRdrEnv shadowing]</span><span>
</span><span id="line-591"></span><span>              </span><span id="local-6989586621681135989"><span class="annot"><span class="annottext">inBracket :: Bool
</span><a href="#local-6989586621681135989"><span class="hs-identifier hs-var hs-var">inBracket</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThStage -&gt; Bool
</span><a href="GHC.Tc.Utils.Env.html#isBrackStage"><span class="hs-identifier hs-var">isBrackStage</span></a></span><span> </span><span class="annot"><span class="annottext">ThStage
</span><a href="#local-6989586621681136001"><span class="hs-identifier hs-var">stage</span></a></span><span>
</span><span id="line-592"></span><span>
</span><span id="line-593"></span><span>              </span><span id="local-6989586621681135987"><span class="annot"><span class="annottext">lcl_env_TH :: TcLclEnv
</span><a href="#local-6989586621681135987"><span class="hs-identifier hs-var hs-var">lcl_env_TH</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681136003"><span class="hs-identifier hs-var">lcl_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_rdr :: LocalRdrEnv
</span><a href="GHC.Tc.Types.html#tcl_rdr"><span class="hs-identifier hs-var">tcl_rdr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocalRdrEnv -&gt; [OccName] -&gt; LocalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#delLocalRdrEnvList"><span class="hs-identifier hs-var">delLocalRdrEnvList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLclEnv -&gt; LocalRdrEnv
</span><a href="GHC.Tc.Types.html#tcl_rdr"><span class="hs-identifier hs-var hs-var">tcl_rdr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681136003"><span class="hs-identifier hs-var">lcl_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[OccName]
</span><a href="#local-6989586621681135984"><span class="hs-identifier hs-var">new_occs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-594"></span><span>                           </span><span class="hs-comment">-- See Note [GlobalRdrEnv shadowing]</span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span>              </span><span id="local-6989586621681135983"><span class="annot"><span class="annottext">lcl_env2 :: TcLclEnv
</span><a href="#local-6989586621681135983"><span class="hs-identifier hs-var hs-var">lcl_env2</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135989"><span class="hs-identifier hs-var">inBracket</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681135987"><span class="hs-identifier hs-var">lcl_env_TH</span></a></span><span>
</span><span id="line-597"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681136003"><span class="hs-identifier hs-var">lcl_env</span></a></span><span>
</span><span id="line-598"></span><span>
</span><span id="line-599"></span><span>              </span><span class="hs-comment">-- Deal with shadowing: see Note [GlobalRdrEnv shadowing]</span><span>
</span><span id="line-600"></span><span>              </span><span id="local-6989586621681135982"><span class="annot"><span class="annottext">want_shadowing :: Bool
</span><a href="#local-6989586621681135982"><span class="hs-identifier hs-var hs-var">want_shadowing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135999"><span class="hs-identifier hs-var">isGHCi</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135989"><span class="hs-identifier hs-var">inBracket</span></a></span><span>
</span><span id="line-601"></span><span>              </span><span id="local-6989586621681135981"><span class="annot"><span class="annottext">rdr_env1 :: GlobalRdrEnv
</span><a href="#local-6989586621681135981"><span class="hs-identifier hs-var hs-var">rdr_env1</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135982"><span class="hs-identifier hs-var">want_shadowing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; [Name] -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#shadowNames"><span class="hs-identifier hs-var">shadowNames</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135997"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135979"><span class="hs-identifier hs-var">new_names</span></a></span><span>
</span><span id="line-602"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135997"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-603"></span><span>
</span><span id="line-604"></span><span>              </span><span id="local-6989586621681135978"><span class="annot"><span class="annottext">lcl_env3 :: TcLclEnv
</span><a href="#local-6989586621681135978"><span class="hs-identifier hs-var hs-var">lcl_env3</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681135983"><span class="hs-identifier hs-var">lcl_env2</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcl_th_bndrs :: ThBindEnv
</span><a href="GHC.Tc.Types.html#tcl_th_bndrs"><span class="hs-identifier hs-var">tcl_th_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThBindEnv -&gt; [(Name, (TopLevelFlag, Int))] -&gt; ThBindEnv
forall a. NameEnv a -&gt; [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#extendNameEnvList"><span class="hs-identifier hs-var">extendNameEnvList</span></a></span><span> </span><span class="annot"><span class="annottext">ThBindEnv
</span><a href="#local-6989586621681135993"><span class="hs-identifier hs-var">th_bndrs</span></a></span><span>
</span><span id="line-605"></span><span>                                                       </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135976"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#TopLevel"><span class="hs-identifier hs-var">TopLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681135991"><span class="hs-identifier hs-var">th_lvl</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span>                                                       </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681135976"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135976"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135979"><span class="hs-identifier hs-var">new_names</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135974"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135974"><span class="hs-identifier hs-var">rdr_env2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrEnv
 -&gt; GlobalRdrElt -&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv)
-&gt; GlobalRdrEnv
-&gt; [GlobalRdrElt]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Data.Foldable.html#foldlM"><span class="hs-identifier hs-var">foldlM</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
-&gt; GlobalRdrElt -&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv
</span><a href="#local-6989586621681135972"><span class="hs-identifier hs-var">add_gre</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135981"><span class="hs-identifier hs-var">rdr_env1</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135971"><span class="hs-identifier hs-var">new_gres</span></a></span><span>
</span><span id="line-609"></span><span>
</span><span id="line-610"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135970"><span class="annot"><span class="annottext">fix_env' :: FixityEnv
</span><a href="#local-6989586621681135970"><span class="hs-identifier hs-var hs-var">fix_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(FixityEnv -&gt; GlobalRdrElt -&gt; FixityEnv)
-&gt; FixityEnv -&gt; [GlobalRdrElt] -&gt; FixityEnv
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">FixityEnv -&gt; GlobalRdrElt -&gt; FixityEnv
</span><a href="#local-6989586621681135968"><span class="hs-identifier hs-var">extend_fix_env</span></a></span><span> </span><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681135995"><span class="hs-identifier hs-var">fix_env</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135971"><span class="hs-identifier hs-var">new_gres</span></a></span><span>
</span><span id="line-611"></span><span>              </span><span id="local-6989586621681135967"><span class="annot"><span class="annottext">gbl_env' :: TcGblEnv
</span><a href="#local-6989586621681135967"><span class="hs-identifier hs-var hs-var">gbl_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681136004"><span class="hs-identifier hs-var">gbl_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_rdr_env :: GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var">tcg_rdr_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135974"><span class="hs-identifier hs-var">rdr_env2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcg_fix_env :: FixityEnv
</span><a href="GHC.Tc.Types.html#tcg_fix_env"><span class="hs-identifier hs-var">tcg_fix_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681135970"><span class="hs-identifier hs-var">fix_env'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-612"></span><span>
</span><span id="line-613"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;extendGlobalRdrEnvRn 2&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; GlobalRdrEnv -&gt; MsgDoc
</span><a href="GHC.Types.Name.Reader.html#pprGlobalRdrEnv"><span class="hs-identifier hs-var">pprGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135974"><span class="hs-identifier hs-var">rdr_env2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv) -&gt; RnM (TcGblEnv, TcLclEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135967"><span class="hs-identifier hs-var">gbl_env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681135978"><span class="hs-identifier hs-var">lcl_env3</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-615"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-616"></span><span>    </span><span id="local-6989586621681135979"><span class="annot"><span class="annottext">new_names :: [Name]
</span><a href="#local-6989586621681135979"><span class="hs-identifier hs-var hs-var">new_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; [Name]) -&gt; [AvailInfo] -&gt; [Name]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNames"><span class="hs-identifier hs-var">availNames</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681136006"><span class="hs-identifier hs-var">avails</span></a></span><span>
</span><span id="line-617"></span><span>    </span><span id="local-6989586621681135984"><span class="annot"><span class="annottext">new_occs :: [OccName]
</span><a href="#local-6989586621681135984"><span class="hs-identifier hs-var hs-var">new_occs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; OccName) -&gt; [Name] -&gt; [OccName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135979"><span class="hs-identifier hs-var">new_names</span></a></span><span>
</span><span id="line-618"></span><span>
</span><span id="line-619"></span><span>    </span><span class="hs-comment">-- If there is a fixity decl for the gre, add it to the fixity env</span><span>
</span><span id="line-620"></span><span>    </span><span id="local-6989586621681135968"><span class="annot"><span class="annottext">extend_fix_env :: FixityEnv -&gt; GlobalRdrElt -&gt; FixityEnv
</span><a href="#local-6989586621681135968"><span class="hs-identifier hs-var hs-var">extend_fix_env</span></a></span></span><span> </span><span id="local-6989586621681135961"><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681135961"><span class="hs-identifier hs-var">fix_env</span></a></span></span><span> </span><span id="local-6989586621681135960"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135960"><span class="hs-identifier hs-var">gre</span></a></span></span><span>
</span><span id="line-621"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135959"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681135959"><span class="hs-identifier hs-var">fi</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MiniFixityEnv -&gt; FastString -&gt; Maybe (Located Fixity)
forall a. FastStringEnv a -&gt; FastString -&gt; Maybe a
</span><a href="GHC.Data.FastString.Env.html#lookupFsEnv"><span class="hs-identifier hs-var">lookupFsEnv</span></a></span><span> </span><span class="annot"><span class="annottext">MiniFixityEnv
</span><a href="#local-6989586621681136005"><span class="hs-identifier hs-var">new_fixities</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135956"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-622"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixityEnv -&gt; Name -&gt; FixItem -&gt; FixityEnv
forall a. NameEnv a -&gt; Name -&gt; a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#extendNameEnv"><span class="hs-identifier hs-var">extendNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681135961"><span class="hs-identifier hs-var">fix_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135954"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; Fixity -&gt; FixItem
</span><a href="GHC.Driver.Types.html#FixItem"><span class="hs-identifier hs-var">FixItem</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135956"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681135959"><span class="hs-identifier hs-var">fi</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-623"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-624"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681135961"><span class="hs-identifier hs-var">fix_env</span></a></span><span>
</span><span id="line-625"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-626"></span><span>        </span><span id="local-6989586621681135954"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681135954"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135960"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-627"></span><span>        </span><span id="local-6989586621681135956"><span class="annot"><span class="annottext">occ :: OccName
</span><a href="#local-6989586621681135956"><span class="hs-identifier hs-var hs-var">occ</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#greOccName"><span class="hs-identifier hs-var">greOccName</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135960"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-628"></span><span>
</span><span id="line-629"></span><span>    </span><span class="annot"><a href="#local-6989586621681135971"><span class="hs-identifier hs-type">new_gres</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- New LocalDef GREs, derived from avails</span><span>
</span><span id="line-630"></span><span>    </span><span id="local-6989586621681135971"><span class="annot"><span class="annottext">new_gres :: [GlobalRdrElt]
</span><a href="#local-6989586621681135971"><span class="hs-identifier hs-var hs-var">new_gres</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; [GlobalRdrElt]) -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#localGREsFromAvail"><span class="hs-identifier hs-var">localGREsFromAvail</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681136006"><span class="hs-identifier hs-var">avails</span></a></span><span>
</span><span id="line-631"></span><span>
</span><span id="line-632"></span><span>    </span><span class="annot"><a href="#local-6989586621681135972"><span class="hs-identifier hs-type">add_gre</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span>
</span><span id="line-633"></span><span>    </span><span class="hs-comment">-- Extend the GlobalRdrEnv with a LocalDef GRE</span><span>
</span><span id="line-634"></span><span>    </span><span class="hs-comment">-- If there is already a LocalDef GRE with the same OccName,</span><span>
</span><span id="line-635"></span><span>    </span><span class="hs-comment">--    report an error and discard the new GRE</span><span>
</span><span id="line-636"></span><span>    </span><span class="hs-comment">-- This establishes INVARIANT 1 of GlobalRdrEnvs</span><span>
</span><span id="line-637"></span><span>    </span><span id="local-6989586621681135972"><span class="annot"><span class="annottext">add_gre :: GlobalRdrEnv
-&gt; GlobalRdrElt -&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv
</span><a href="#local-6989586621681135972"><span class="hs-identifier hs-var hs-var">add_gre</span></a></span></span><span> </span><span id="local-6989586621681135949"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135949"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621681135948"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135948"><span class="hs-identifier hs-var">gre</span></a></span></span><span>
</span><span id="line-638"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135946"><span class="hs-identifier hs-var">dups</span></a></span><span class="hs-special">)</span><span>    </span><span class="hs-comment">-- Same OccName defined twice</span><span>
</span><span id="line-639"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#addDupDeclErr"><span class="hs-identifier hs-var">addDupDeclErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135948"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135946"><span class="hs-identifier hs-var">dups</span></a></span><span class="hs-special">)</span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135949"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-640"></span><span>
</span><span id="line-641"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-642"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; IOEnv (Env TcGblEnv TcLclEnv) GlobalRdrEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; GlobalRdrElt -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#extendGlobalRdrEnv"><span class="hs-identifier hs-var">extendGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135949"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135948"><span class="hs-identifier hs-var">gre</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-643"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-644"></span><span>        </span><span id="local-6989586621681135943"><span class="annot"><span class="annottext">occ :: OccName
</span><a href="#local-6989586621681135943"><span class="hs-identifier hs-var hs-var">occ</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#greOccName"><span class="hs-identifier hs-var">greOccName</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135948"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-645"></span><span>        </span><span id="local-6989586621681135946"><span class="annot"><span class="annottext">dups :: [GlobalRdrElt]
</span><a href="#local-6989586621681135946"><span class="hs-identifier hs-var hs-var">dups</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Bool) -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135942"><span class="hs-identifier hs-var">isDupGRE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; OccName -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGlobalRdrEnv"><span class="hs-identifier hs-var">lookupGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135949"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135943"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span>        </span><span class="hs-comment">-- Duplicate GREs are those defined locally with the same OccName,</span><span>
</span><span id="line-647"></span><span>        </span><span class="hs-comment">-- except cases where *both* GREs are DuplicateRecordFields (#17965).</span><span>
</span><span id="line-648"></span><span>        </span><span id="local-6989586621681135942"><span class="annot"><span class="annottext">isDupGRE :: GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135942"><span class="hs-identifier hs-var hs-var">isDupGRE</span></a></span></span><span> </span><span id="local-6989586621681135940"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135940"><span class="hs-identifier hs-var">gre'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isLocalGRE"><span class="hs-identifier hs-var">isLocalGRE</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135940"><span class="hs-identifier hs-var">gre'</span></a></span><span>
</span><span id="line-649"></span><span>                </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isOverloadedRecFldGRE"><span class="hs-identifier hs-var">isOverloadedRecFldGRE</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135948"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isOverloadedRecFldGRE"><span class="hs-identifier hs-var">isOverloadedRecFldGRE</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135940"><span class="hs-identifier hs-var">gre'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-650"></span><span>
</span><span id="line-651"></span><span>
</span><span id="line-652"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
    getLocalDeclBindersd@ returns the names for an HsDecl
             It's used for source code.

        *** See Note [The Naming story] in GHC.Hs.Decls ****
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span class="annot"><a href="GHC.Rename.Names.html#getLocalNonValBinders"><span class="hs-identifier hs-type">getLocalNonValBinders</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Rename.Fixity.html#MiniFixityEnv"><span class="hs-identifier hs-type">MiniFixityEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#HsGroup"><span class="hs-identifier hs-type">HsGroup</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-662"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-663"></span><span class="hs-comment">-- Get all the top-level binders bound the group *except*</span><span>
</span><span id="line-664"></span><span class="hs-comment">-- for value bindings, which are treated separately</span><span>
</span><span id="line-665"></span><span class="hs-comment">-- Specifically we return AvailInfo for</span><span>
</span><span id="line-666"></span><span class="hs-comment">--      * type decls (incl constructors and record selectors)</span><span>
</span><span id="line-667"></span><span class="hs-comment">--      * class decls (including class ops)</span><span>
</span><span id="line-668"></span><span class="hs-comment">--      * associated types</span><span>
</span><span id="line-669"></span><span class="hs-comment">--      * foreign imports</span><span>
</span><span id="line-670"></span><span class="hs-comment">--      * value signatures (in hs-boot files only)</span><span>
</span><span id="line-671"></span><span>
</span><span id="line-672"></span><span id="getLocalNonValBinders"><span class="annot"><span class="annottext">getLocalNonValBinders :: MiniFixityEnv -&gt; HsGroup GhcPs -&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
</span><a href="GHC.Rename.Names.html#getLocalNonValBinders"><span class="hs-identifier hs-var hs-var">getLocalNonValBinders</span></a></span></span><span> </span><span id="local-6989586621681135936"><span class="annot"><span class="annottext">MiniFixityEnv
</span><a href="#local-6989586621681135936"><span class="hs-identifier hs-var">fixity_env</span></a></span></span><span>
</span><span id="line-673"></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsGroup"><span class="hs-identifier hs-type">HsGroup</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hs_valds :: forall p. HsGroup p -&gt; HsValBinds p
</span><a href="GHC.Hs.Decls.html#hs_valds"><span class="hs-identifier hs-var">hs_valds</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135933"><span class="annot"><span class="annottext">HsValBinds GhcPs
</span><a href="#local-6989586621681135933"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-674"></span><span>                </span><span class="annot"><span class="annottext">hs_tyclds :: forall p. HsGroup p -&gt; [TyClGroup p]
</span><a href="GHC.Hs.Decls.html#hs_tyclds"><span class="hs-identifier hs-var">hs_tyclds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135931"><span class="annot"><span class="annottext">[TyClGroup GhcPs]
</span><a href="#local-6989586621681135931"><span class="hs-identifier hs-var">tycl_decls</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-675"></span><span>                </span><span class="annot"><span class="annottext">hs_fords :: forall p. HsGroup p -&gt; [LForeignDecl p]
</span><a href="GHC.Hs.Decls.html#hs_fords"><span class="hs-identifier hs-var">hs_fords</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135929"><span class="annot"><span class="annottext">[LForeignDecl GhcPs]
</span><a href="#local-6989586621681135929"><span class="hs-identifier hs-var">foreign_decls</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-676"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- Process all type/class decls *except* family instances</span><span>
</span><span id="line-677"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135928"><span class="annot"><span class="annottext">inst_decls :: [LInstDecl GhcPs]
</span><a href="#local-6989586621681135928"><span class="hs-identifier hs-var hs-var">inst_decls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyClGroup GhcPs]
</span><a href="#local-6989586621681135931"><span class="hs-identifier hs-var">tycl_decls</span></a></span><span> </span><span class="annot"><span class="annottext">[TyClGroup GhcPs]
-&gt; (TyClGroup GhcPs -&gt; [LInstDecl GhcPs]) -&gt; [LInstDecl GhcPs]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">TyClGroup GhcPs -&gt; [LInstDecl GhcPs]
forall pass. TyClGroup pass -&gt; [LInstDecl pass]
</span><a href="GHC.Hs.Decls.html#group_instds"><span class="hs-identifier hs-var hs-var">group_instds</span></a></span><span>
</span><span id="line-678"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135926"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135926"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. Extension -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#xoptM"><span class="hs-identifier hs-var">xoptM</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#DuplicateRecordFields"><span class="hs-identifier hs-var">LangExt.DuplicateRecordFields</span></a></span><span>
</span><span id="line-679"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135924"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135924"><span class="hs-identifier hs-var">tc_avails</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135923"><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135923"><span class="hs-identifier hs-var">tc_fldss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-680"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([(AvailInfo, [(Name, [FieldLabel])])]
 -&gt; ([AvailInfo], [[(Name, [FieldLabel])]]))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) [(AvailInfo, [(Name, [FieldLabel])])]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [[(Name, [FieldLabel])]])
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">[(AvailInfo, [(Name, [FieldLabel])])]
-&gt; ([AvailInfo], [[(Name, [FieldLabel])]])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv
   (Env TcGblEnv TcLclEnv) [(AvailInfo, [(Name, [FieldLabel])])]
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv) ([AvailInfo], [[(Name, [FieldLabel])]]))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) [(AvailInfo, [(Name, [FieldLabel])])]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [[(Name, [FieldLabel])]])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LTyClDecl GhcPs
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])]))
-&gt; [LTyClDecl GhcPs]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) [(AvailInfo, [(Name, [FieldLabel])])]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; LTyClDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135920"><span class="hs-identifier hs-var">new_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135926"><span class="hs-identifier hs-var">overload_ok</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-681"></span><span>                                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyClGroup GhcPs] -&gt; [LTyClDecl GhcPs]
forall pass. [TyClGroup pass] -&gt; [LTyClDecl pass]
</span><a href="GHC.Hs.Decls.html#tyClGroupTyClDecls"><span class="hs-identifier hs-var">tyClGroupTyClDecls</span></a></span><span> </span><span class="annot"><span class="annottext">[TyClGroup GhcPs]
</span><a href="#local-6989586621681135931"><span class="hs-identifier hs-var">tycl_decls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-682"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLocalNonValBinders 1&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135924"><span class="hs-identifier hs-var">tc_avails</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-683"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135918"><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv)
</span><a href="#local-6989586621681135918"><span class="hs-identifier hs-var">envs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; MiniFixityEnv -&gt; RnM (TcGblEnv, TcLclEnv)
</span><a href="GHC.Rename.Names.html#extendGlobalRdrEnvRn"><span class="hs-identifier hs-var">extendGlobalRdrEnvRn</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135924"><span class="hs-identifier hs-var">tc_avails</span></a></span><span> </span><span class="annot"><span class="annottext">MiniFixityEnv
</span><a href="#local-6989586621681135936"><span class="hs-identifier hs-var">fixity_env</span></a></span><span>
</span><span id="line-684"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv)
-&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
-&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
forall gbl' lcl' a gbl lcl.
(gbl', lcl') -&gt; TcRnIf gbl' lcl' a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setEnvs"><span class="hs-identifier hs-var">setEnvs</span></a></span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv)
</span><a href="#local-6989586621681135918"><span class="hs-identifier hs-var">envs</span></a></span><span> </span><span class="annot"><span class="annottext">(RnM ((TcGblEnv, TcLclEnv), Defs)
 -&gt; RnM ((TcGblEnv, TcLclEnv), Defs))
-&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
-&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-685"></span><span>            </span><span class="hs-comment">-- Bring these things into scope first</span><span>
</span><span id="line-686"></span><span>            </span><span class="hs-comment">-- See Note [Looking up family names in family instances]</span><span>
</span><span id="line-687"></span><span>
</span><span id="line-688"></span><span>          </span><span class="hs-comment">-- Process all family instances</span><span>
</span><span id="line-689"></span><span>          </span><span class="hs-comment">-- to bring new data constructors into scope</span><span>
</span><span id="line-690"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135916"><span class="annot"><span class="annottext">[[AvailInfo]]
</span><a href="#local-6989586621681135916"><span class="hs-identifier hs-var">nti_availss</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135915"><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135915"><span class="hs-identifier hs-var">nti_fldss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LInstDecl GhcPs
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])]))
-&gt; [LInstDecl GhcPs]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([[AvailInfo]], [[(Name, [FieldLabel])]])
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; m (b, c)) -&gt; [a] -&gt; m ([b], [c])
</span><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier hs-var">mapAndUnzipM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; LInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135913"><span class="hs-identifier hs-var">new_assoc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135926"><span class="hs-identifier hs-var">overload_ok</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-691"></span><span>                                                   </span><span class="annot"><span class="annottext">[LInstDecl GhcPs]
</span><a href="#local-6989586621681135928"><span class="hs-identifier hs-var">inst_decls</span></a></span><span>
</span><span id="line-692"></span><span>
</span><span id="line-693"></span><span>          </span><span class="hs-comment">-- Finish off with value binders:</span><span>
</span><span id="line-694"></span><span>          </span><span class="hs-comment">--    foreign decls and pattern synonyms for an ordinary module</span><span>
</span><span id="line-695"></span><span>          </span><span class="hs-comment">--    type sigs in case of a hs-boot file only</span><span>
</span><span id="line-696"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135912"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135912"><span class="hs-identifier hs-var">is_boot</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv Bool
</span><a href="GHC.Tc.Utils.Monad.html#tcIsHsBootOrSig"><span class="hs-identifier hs-var">tcIsHsBootOrSig</span></a></span><span>
</span><span id="line-697"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135910"><span class="annot"><span class="annottext">val_bndrs :: [GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135910"><span class="hs-identifier hs-var hs-var">val_bndrs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135912"><span class="hs-identifier hs-var">is_boot</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135909"><span class="hs-identifier hs-var">hs_boot_sig_bndrs</span></a></span><span>
</span><span id="line-698"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135908"><span class="hs-identifier hs-var">for_hs_bndrs</span></a></span><span>
</span><span id="line-699"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135907"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135907"><span class="hs-identifier hs-var">val_avails</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan RdrName
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) AvailInfo)
-&gt; [GenLocated SrcSpan RdrName]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [AvailInfo]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName
-&gt; IOEnv (Env TcGblEnv TcLclEnv) AvailInfo
</span><a href="#local-6989586621681135906"><span class="hs-identifier hs-var">new_simple</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135910"><span class="hs-identifier hs-var">val_bndrs</span></a></span><span>
</span><span id="line-700"></span><span>
</span><span id="line-701"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135905"><span class="annot"><span class="annottext">avails :: [AvailInfo]
</span><a href="#local-6989586621681135905"><span class="hs-identifier hs-var hs-var">avails</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[AvailInfo]] -&gt; [AvailInfo]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[AvailInfo]]
</span><a href="#local-6989586621681135916"><span class="hs-identifier hs-var">nti_availss</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [AvailInfo] -&gt; [AvailInfo]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135907"><span class="hs-identifier hs-var">val_avails</span></a></span><span>
</span><span id="line-702"></span><span>              </span><span id="local-6989586621681135903"><span class="annot"><span class="annottext">new_bndrs :: Defs
</span><a href="#local-6989586621681135903"><span class="hs-identifier hs-var hs-var">new_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; Defs
</span><a href="GHC.Types.Avail.html#availsToNameSetWithSelectors"><span class="hs-identifier hs-var">availsToNameSetWithSelectors</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135905"><span class="hs-identifier hs-var">avails</span></a></span><span> </span><span class="annot"><span class="annottext">Defs -&gt; Defs -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#unionNameSet"><span class="hs-operator hs-var">`unionNameSet`</span></a></span><span>
</span><span id="line-703"></span><span>                          </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; Defs
</span><a href="GHC.Types.Avail.html#availsToNameSetWithSelectors"><span class="hs-identifier hs-var">availsToNameSetWithSelectors</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135924"><span class="hs-identifier hs-var">tc_avails</span></a></span><span>
</span><span id="line-704"></span><span>              </span><span id="local-6989586621681135900"><span class="annot"><span class="annottext">flds :: [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135900"><span class="hs-identifier hs-var hs-var">flds</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]] -&gt; [(Name, [FieldLabel])]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135915"><span class="hs-identifier hs-var">nti_fldss</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
-&gt; [(Name, [FieldLabel])] -&gt; [(Name, [FieldLabel])]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]] -&gt; [(Name, [FieldLabel])]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135923"><span class="hs-identifier hs-var">tc_fldss</span></a></span><span>
</span><span id="line-705"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLocalNonValBinders 2&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135905"><span class="hs-identifier hs-var">avails</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-706"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135899"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135899"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135898"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681135898"><span class="hs-identifier hs-var">tcl_env</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; MiniFixityEnv -&gt; RnM (TcGblEnv, TcLclEnv)
</span><a href="GHC.Rename.Names.html#extendGlobalRdrEnvRn"><span class="hs-identifier hs-var">extendGlobalRdrEnvRn</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135905"><span class="hs-identifier hs-var">avails</span></a></span><span> </span><span class="annot"><span class="annottext">MiniFixityEnv
</span><a href="#local-6989586621681135936"><span class="hs-identifier hs-var">fixity_env</span></a></span><span>
</span><span id="line-707"></span><span>
</span><span id="line-708"></span><span>        </span><span class="hs-comment">-- Force the field access so that tcg_env is not retained. The</span><span>
</span><span id="line-709"></span><span>        </span><span class="hs-comment">-- selector thunk optimisation doesn't kick-in, see #20139</span><span>
</span><span id="line-710"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681135897"><span class="annot"><span class="annottext">old_field_env :: NameEnv [FieldLabel]
</span><a href="#local-6989586621681135897"><span class="hs-identifier hs-var hs-var">old_field_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; NameEnv [FieldLabel]
</span><a href="GHC.Tc.Types.html#tcg_field_env"><span class="hs-identifier hs-var hs-var">tcg_field_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135899"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-711"></span><span>        </span><span class="hs-comment">-- Extend tcg_field_env with new fields (this used to be the</span><span>
</span><span id="line-712"></span><span>        </span><span class="hs-comment">-- work of extendRecordFieldEnv)</span><span>
</span><span id="line-713"></span><span>              </span><span id="local-6989586621681135895"><span class="annot"><span class="annottext">field_env :: NameEnv [FieldLabel]
</span><a href="#local-6989586621681135895"><span class="hs-identifier hs-var hs-var">field_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv [FieldLabel]
-&gt; [(Name, [FieldLabel])] -&gt; NameEnv [FieldLabel]
forall a. NameEnv a -&gt; [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#extendNameEnvList"><span class="hs-identifier hs-var">extendNameEnvList</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [FieldLabel]
</span><a href="#local-6989586621681135897"><span class="hs-identifier hs-var">old_field_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135900"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-714"></span><span>              </span><span id="local-6989586621681135894"><span class="annot"><span class="annottext">envs :: (TcGblEnv, TcLclEnv)
</span><a href="#local-6989586621681135894"><span class="hs-identifier hs-var hs-var">envs</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135899"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_field_env :: NameEnv [FieldLabel]
</span><a href="GHC.Tc.Types.html#tcg_field_env"><span class="hs-identifier hs-var">tcg_field_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv [FieldLabel]
</span><a href="#local-6989586621681135895"><span class="hs-identifier hs-var">field_env</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681135898"><span class="hs-identifier hs-var">tcl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-715"></span><span>
</span><span id="line-716"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLocalNonValBinders 3&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">[(Name, [FieldLabel])] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135900"><span class="hs-identifier hs-var">flds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">NameEnv [FieldLabel] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [FieldLabel]
</span><a href="#local-6989586621681135895"><span class="hs-identifier hs-var">field_env</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-717"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">((TcGblEnv, TcLclEnv), Defs) -&gt; RnM ((TcGblEnv, TcLclEnv), Defs)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv)
</span><a href="#local-6989586621681135894"><span class="hs-identifier hs-var">envs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135903"><span class="hs-identifier hs-var">new_bndrs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-718"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-719"></span><span>    </span><span class="annot"><a href="GHC.Hs.Binds.html#ValBinds"><span class="hs-identifier hs-type">ValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XValBinds GhcPs GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135892"><span class="annot"><span class="annottext">LHsBindsLR GhcPs GhcPs
</span><a href="#local-6989586621681135892"><span class="hs-identifier hs-var">_val_binds</span></a></span></span><span> </span><span id="local-6989586621681135891"><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621681135891"><span class="hs-identifier hs-var">val_sigs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsValBinds GhcPs
</span><a href="#local-6989586621681135933"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-720"></span><span>
</span><span id="line-721"></span><span>    </span><span class="annot"><a href="#local-6989586621681135908"><span class="hs-identifier hs-type">for_hs_bndrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-722"></span><span>    </span><span id="local-6989586621681135908"><span class="annot"><span class="annottext">for_hs_bndrs :: [GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135908"><span class="hs-identifier hs-var hs-var">for_hs_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LForeignDecl GhcPs] -&gt; [Located (IdP GhcPs)]
forall pass. [LForeignDecl pass] -&gt; [Located (IdP pass)]
</span><a href="GHC.Hs.Utils.html#hsForeignDeclsBinders"><span class="hs-identifier hs-var">hsForeignDeclsBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[LForeignDecl GhcPs]
</span><a href="#local-6989586621681135929"><span class="hs-identifier hs-var">foreign_decls</span></a></span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span>    </span><span class="hs-comment">-- In a hs-boot file, the value binders come from the</span><span>
</span><span id="line-725"></span><span>    </span><span class="hs-comment">--  *signatures*, and there should be no foreign binders</span><span>
</span><span id="line-726"></span><span>    </span><span id="local-6989586621681135909"><span class="annot"><span class="annottext">hs_boot_sig_bndrs :: [GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135909"><span class="hs-identifier hs-var hs-var">hs_boot_sig_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; RdrName -&gt; GenLocated SrcSpan RdrName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135889"><span class="hs-identifier hs-var">decl_loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName -&gt; RdrName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName
</span><a href="#local-6989586621681135888"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-727"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135889"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135889"><span class="hs-identifier hs-var">decl_loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#TypeSig"><span class="hs-identifier hs-type">TypeSig</span></a></span><span> </span><span class="annot"><span class="annottext">XTypeSig GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135886"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621681135886"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcPs
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621681135891"><span class="hs-identifier hs-var">val_sigs</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135888"><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName
</span><a href="#local-6989586621681135888"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621681135886"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-728"></span><span>
</span><span id="line-729"></span><span>      </span><span class="hs-comment">-- the SrcSpan attached to the input should be the span of the</span><span>
</span><span id="line-730"></span><span>      </span><span class="hs-comment">-- declaration, not just the name</span><span>
</span><span id="line-731"></span><span>    </span><span class="annot"><a href="#local-6989586621681135906"><span class="hs-identifier hs-type">new_simple</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span>
</span><span id="line-732"></span><span>    </span><span id="local-6989586621681135906"><span class="annot"><span class="annottext">new_simple :: GenLocated SrcSpan RdrName
-&gt; IOEnv (Env TcGblEnv TcLclEnv) AvailInfo
</span><a href="#local-6989586621681135906"><span class="hs-identifier hs-var hs-var">new_simple</span></a></span></span><span> </span><span id="local-6989586621681135885"><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName
</span><a href="#local-6989586621681135885"><span class="hs-identifier hs-var">rdr_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135884"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135884"><span class="hs-identifier hs-var">nm</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName -&gt; RnM Name
</span><a href="GHC.Rename.Env.html#newTopSrcBinder"><span class="hs-identifier hs-var">newTopSrcBinder</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName
</span><a href="#local-6989586621681135885"><span class="hs-identifier hs-var">rdr_name</span></a></span><span>
</span><span id="line-733"></span><span>                            </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; IOEnv (Env TcGblEnv TcLclEnv) AvailInfo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#avail"><span class="hs-identifier hs-var">avail</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135884"><span class="hs-identifier hs-var">nm</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-734"></span><span>
</span><span id="line-735"></span><span>    </span><span class="annot"><a href="#local-6989586621681135920"><span class="hs-identifier hs-type">new_tc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#LTyClDecl"><span class="hs-identifier hs-type">LTyClDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-736"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-737"></span><span>    </span><span id="local-6989586621681135920"><span class="annot"><span class="annottext">new_tc :: Bool
-&gt; LTyClDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135920"><span class="hs-identifier hs-var hs-var">new_tc</span></a></span></span><span> </span><span id="local-6989586621681135881"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135881"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span id="local-6989586621681135880"><span class="annot"><span class="annottext">LTyClDecl GhcPs
</span><a href="#local-6989586621681135880"><span class="hs-identifier hs-var">tc_decl</span></a></span></span><span> </span><span class="hs-comment">-- NOT for type/data instances</span><span>
</span><span id="line-738"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135879"><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135879"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135878"><span class="annot"><span class="annottext">[LFieldOcc GhcPs]
</span><a href="#local-6989586621681135878"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LTyClDecl GhcPs -&gt; ([Located (IdP GhcPs)], [LFieldOcc GhcPs])
forall (p :: Pass).
IsPass p =&gt;
Located (TyClDecl (GhcPass p))
-&gt; ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
</span><a href="GHC.Hs.Utils.html#hsLTyClDeclBinders"><span class="hs-identifier hs-var">hsLTyClDeclBinders</span></a></span><span> </span><span class="annot"><span class="annottext">LTyClDecl GhcPs
</span><a href="#local-6989586621681135880"><span class="hs-identifier hs-var">tc_decl</span></a></span><span>
</span><span id="line-739"></span><span>             </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135876"><span class="annot"><span class="annottext">names :: [Name]
</span><a href="#local-6989586621681135876"><span class="hs-identifier hs-var">names</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681135875"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135875"><span class="hs-identifier hs-var">main_name</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681135874"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135874"><span class="hs-identifier hs-var">sub_names</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan RdrName -&gt; RnM Name)
-&gt; [GenLocated SrcSpan RdrName]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [Name]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName -&gt; RnM Name
</span><a href="GHC.Rename.Env.html#newTopSrcBinder"><span class="hs-identifier hs-var">newTopSrcBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135879"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-740"></span><span>             </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135873"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135873"><span class="hs-identifier hs-var">flds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LFieldOcc GhcPs -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel)
-&gt; [LFieldOcc GhcPs] -&gt; IOEnv (Env TcGblEnv TcLclEnv) [FieldLabel]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; [Name]
-&gt; LFieldOcc GhcPs
-&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
</span><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier hs-var">newRecordSelector</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135881"><span class="hs-identifier hs-var">overload_ok</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135874"><span class="hs-identifier hs-var">sub_names</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LFieldOcc GhcPs]
</span><a href="#local-6989586621681135878"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-741"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135872"><span class="annot"><span class="annottext">fld_env :: [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135872"><span class="hs-identifier hs-var hs-var">fld_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LTyClDecl GhcPs -&gt; TyClDecl GhcPs
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LTyClDecl GhcPs
</span><a href="#local-6989586621681135880"><span class="hs-identifier hs-var">tc_decl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-742"></span><span>                     </span><span class="annot"><a href="GHC.Hs.Decls.html#DataDecl"><span class="hs-identifier hs-type">DataDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcdDataDefn :: forall pass. TyClDecl pass -&gt; HsDataDefn pass
</span><a href="GHC.Hs.Decls.html#tcdDataDefn"><span class="hs-identifier hs-var">tcdDataDefn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135869"><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621681135869"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
-&gt; [Name] -&gt; [FieldLabel] -&gt; [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135868"><span class="hs-identifier hs-var">mk_fld_env</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621681135869"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135876"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135873"><span class="hs-identifier hs-var">flds'</span></a></span><span>
</span><span id="line-743"></span><span>                     </span><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-744"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(AvailInfo, [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135875"><span class="hs-identifier hs-var">main_name</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135876"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135873"><span class="hs-identifier hs-var">flds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135872"><span class="hs-identifier hs-var">fld_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-745"></span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span>    </span><span class="hs-comment">-- Calculate the mapping from constructor names to fields, which</span><span>
</span><span id="line-748"></span><span>    </span><span class="hs-comment">-- will go in tcg_field_env. It's convenient to do this here where</span><span>
</span><span id="line-749"></span><span>    </span><span class="hs-comment">-- we are working with a single datatype definition.</span><span>
</span><span id="line-750"></span><span>    </span><span class="annot"><a href="#local-6989586621681135868"><span class="hs-identifier hs-type">mk_fld_env</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#HsDataDefn"><span class="hs-identifier hs-type">HsDataDefn</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-751"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-752"></span><span>    </span><span id="local-6989586621681135868"><span class="annot"><span class="annottext">mk_fld_env :: HsDataDefn GhcPs
-&gt; [Name] -&gt; [FieldLabel] -&gt; [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135868"><span class="hs-identifier hs-var hs-var">mk_fld_env</span></a></span></span><span> </span><span id="local-6989586621681135866"><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621681135866"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span id="local-6989586621681135865"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135865"><span class="hs-identifier hs-var">names</span></a></span></span><span> </span><span id="local-6989586621681135864"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135864"><span class="hs-identifier hs-var">flds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (ConDecl GhcPs) -&gt; [(Name, [FieldLabel])])
-&gt; [GenLocated SrcSpan (ConDecl GhcPs)] -&gt; [(Name, [FieldLabel])]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (ConDecl GhcPs) -&gt; [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135863"><span class="hs-identifier hs-var">find_con_flds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; [GenLocated SrcSpan (ConDecl GhcPs)]
forall pass. HsDataDefn pass -&gt; [LConDecl pass]
</span><a href="GHC.Hs.Decls.html#dd_cons"><span class="hs-identifier hs-var hs-var">dd_cons</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621681135866"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-753"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-754"></span><span>        </span><span id="local-6989586621681135863"><span class="annot"><span class="annottext">find_con_flds :: GenLocated SrcSpan (ConDecl GhcPs) -&gt; [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135863"><span class="hs-identifier hs-var hs-var">find_con_flds</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">con_name :: forall pass. ConDecl pass -&gt; Located (IdP pass)
</span><a href="GHC.Hs.Decls.html#con_name"><span class="hs-identifier hs-var">con_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135859"><span class="annot"><span class="annottext">IdP GhcPs
</span><a href="#local-6989586621681135859"><span class="hs-identifier hs-var">rdr</span></a></span></span><span>
</span><span id="line-755"></span><span>                                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">con_args :: forall pass. ConDecl pass -&gt; HsConDeclDetails pass
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681135856"><span class="annot"><span class="annottext">Located [LConDeclField GhcPs]
</span><a href="#local-6989586621681135856"><span class="hs-identifier hs-var">cdflds</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-756"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; Name
</span><a href="#local-6989586621681135855"><span class="hs-identifier hs-var">find_con_name</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681135859"><span class="hs-identifier hs-var">rdr</span></a></span><span>
</span><span id="line-757"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(LConDeclField GhcPs -&gt; [FieldLabel])
-&gt; [LConDeclField GhcPs] -&gt; [FieldLabel]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; [FieldLabel]
</span><a href="#local-6989586621681135854"><span class="hs-identifier hs-var">find_con_decl_flds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located [LConDeclField GhcPs] -&gt; [LConDeclField GhcPs]
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located [LConDeclField GhcPs]
</span><a href="#local-6989586621681135856"><span class="hs-identifier hs-var">cdflds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-758"></span><span>        </span><span class="annot"><a href="#local-6989586621681135863"><span class="hs-identifier hs-var">find_con_flds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ConDeclGADT"><span class="hs-identifier hs-type">ConDeclGADT</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">con_names :: forall pass. ConDecl pass -&gt; [Located (IdP pass)]
</span><a href="GHC.Hs.Decls.html#con_names"><span class="hs-identifier hs-var">con_names</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135851"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621681135851"><span class="hs-identifier hs-var">rdrs</span></a></span></span><span>
</span><span id="line-759"></span><span>                                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">con_args :: forall pass. ConDecl pass -&gt; HsConDeclDetails pass
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681135850"><span class="annot"><span class="annottext">Located [LConDeclField GhcPs]
</span><a href="#local-6989586621681135850"><span class="hs-identifier hs-var">flds</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-760"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; Name
</span><a href="#local-6989586621681135855"><span class="hs-identifier hs-var">find_con_name</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135849"><span class="hs-identifier hs-var">rdr</span></a></span><span>
</span><span id="line-761"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(LConDeclField GhcPs -&gt; [FieldLabel])
-&gt; [LConDeclField GhcPs] -&gt; [FieldLabel]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; [FieldLabel]
</span><a href="#local-6989586621681135854"><span class="hs-identifier hs-var">find_con_decl_flds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located [LConDeclField GhcPs] -&gt; [LConDeclField GhcPs]
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located [LConDeclField GhcPs]
</span><a href="#local-6989586621681135850"><span class="hs-identifier hs-var">flds</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-762"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135849"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135849"><span class="hs-identifier hs-var">rdr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621681135851"><span class="hs-identifier hs-var">rdrs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-763"></span><span>
</span><span id="line-764"></span><span>        </span><span class="annot"><a href="#local-6989586621681135863"><span class="hs-identifier hs-var">find_con_flds</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (ConDecl GhcPs)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-765"></span><span>
</span><span id="line-766"></span><span>        </span><span id="local-6989586621681135855"><span class="annot"><span class="annottext">find_con_name :: RdrName -&gt; Name
</span><a href="#local-6989586621681135855"><span class="hs-identifier hs-var hs-var">find_con_name</span></a></span></span><span> </span><span id="local-6989586621681135848"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135848"><span class="hs-identifier hs-var">rdr</span></a></span></span><span>
</span><span id="line-767"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe Name -&gt; Name
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLocalNonValBinders/find_con_name&quot;</span></span><span> </span><span class="annot"><span class="annottext">(Maybe Name -&gt; Name) -&gt; Maybe Name -&gt; Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-768"></span><span>              </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; Maybe Name
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681135846"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135846"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135846"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135848"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135865"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-769"></span><span>        </span><span id="local-6989586621681135854"><span class="annot"><span class="annottext">find_con_decl_flds :: LConDeclField GhcPs -&gt; [FieldLabel]
</span><a href="#local-6989586621681135854"><span class="hs-identifier hs-var hs-var">find_con_decl_flds</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135844"><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621681135844"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-770"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LFieldOcc GhcPs -&gt; FieldLabel)
-&gt; [LFieldOcc GhcPs] -&gt; [FieldLabel]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LFieldOcc GhcPs -&gt; FieldLabel
</span><a href="#local-6989586621681135843"><span class="hs-identifier hs-var">find_con_decl_fld</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDeclField GhcPs -&gt; [LFieldOcc GhcPs]
forall pass. ConDeclField pass -&gt; [LFieldOcc pass]
</span><a href="GHC.Hs.Type.html#cd_fld_names"><span class="hs-identifier hs-var hs-var">cd_fld_names</span></a></span><span> </span><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621681135844"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-771"></span><span>
</span><span id="line-772"></span><span>        </span><span id="local-6989586621681135843"><span class="annot"><span class="annottext">find_con_decl_fld :: LFieldOcc GhcPs -&gt; FieldLabel
</span><a href="#local-6989586621681135843"><span class="hs-identifier hs-var hs-var">find_con_decl_fld</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#FieldOcc"><span class="hs-identifier hs-type">FieldOcc</span></a></span><span> </span><span class="annot"><span class="annottext">XCFieldOcc GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135840"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135840"><span class="hs-identifier hs-var">rdr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-773"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe FieldLabel -&gt; FieldLabel
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLocalNonValBinders/find_con_decl_fld&quot;</span></span><span> </span><span class="annot"><span class="annottext">(Maybe FieldLabel -&gt; FieldLabel) -&gt; Maybe FieldLabel -&gt; FieldLabel
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-774"></span><span>              </span><span class="annot"><span class="annottext">(FieldLabel -&gt; Bool) -&gt; [FieldLabel] -&gt; Maybe FieldLabel
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681135839"><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681135839"><span class="hs-identifier hs-var">fl</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; FastString
forall a. FieldLbl a -&gt; FastString
</span><a href="GHC.Types.FieldLabel.html#flLabel"><span class="hs-identifier hs-var hs-var">flLabel</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681135839"><span class="hs-identifier hs-var">fl</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; FastString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681135837"><span class="hs-identifier hs-var">lbl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135864"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-775"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681135837"><span class="annot"><span class="annottext">lbl :: FastString
</span><a href="#local-6989586621681135837"><span class="hs-identifier hs-var hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135840"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-776"></span><span>
</span><span id="line-777"></span><span>    </span><span class="annot"><a href="#local-6989586621681135913"><span class="hs-identifier hs-type">new_assoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#LInstDecl"><span class="hs-identifier hs-type">LInstDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-778"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-779"></span><span>    </span><span id="local-6989586621681135913"><span class="annot"><span class="annottext">new_assoc :: Bool
-&gt; LInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135913"><span class="hs-identifier hs-var hs-var">new_assoc</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#TyFamInstD"><span class="hs-identifier hs-type">TyFamInstD</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([AvailInfo], [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-780"></span><span>      </span><span class="hs-comment">-- type instances don't bind new names</span><span>
</span><span id="line-781"></span><span>
</span><span id="line-782"></span><span>    </span><span class="annot"><a href="#local-6989586621681135913"><span class="hs-identifier hs-var">new_assoc</span></a></span><span> </span><span id="local-6989586621681135835"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135835"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#DataFamInstD"><span class="hs-identifier hs-type">DataFamInstD</span></a></span><span> </span><span class="annot"><span class="annottext">XDataFamInstD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135833"><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135833"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-783"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135832"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135832"><span class="hs-identifier hs-var">avail</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135831"><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135831"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Maybe Name
-&gt; DataFamInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135830"><span class="hs-identifier hs-var">new_di</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135835"><span class="hs-identifier hs-var">overload_ok</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Name
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135833"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-784"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([AvailInfo], [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135832"><span class="hs-identifier hs-var">avail</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135831"><span class="hs-identifier hs-var">flds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-785"></span><span>    </span><span class="annot"><a href="#local-6989586621681135913"><span class="hs-identifier hs-var">new_assoc</span></a></span><span> </span><span id="local-6989586621681135829"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135829"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ClsInstD"><span class="hs-identifier hs-type">ClsInstD</span></a></span><span> </span><span class="annot"><span class="annottext">XClsInstD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ClsInstDecl"><span class="hs-identifier hs-type">ClsInstDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cid_poly_ty :: forall pass. ClsInstDecl pass -&gt; LHsSigType pass
</span><a href="GHC.Hs.Decls.html#cid_poly_ty"><span class="hs-identifier hs-var">cid_poly_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135825"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621681135825"><span class="hs-identifier hs-var">inst_ty</span></a></span></span><span>
</span><span id="line-786"></span><span>                                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cid_datafam_insts :: forall pass. ClsInstDecl pass -&gt; [LDataFamInstDecl pass]
</span><a href="GHC.Hs.Decls.html#cid_datafam_insts"><span class="hs-identifier hs-var">cid_datafam_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135823"><span class="annot"><span class="annottext">[LDataFamInstDecl GhcPs]
</span><a href="#local-6989586621681135823"><span class="hs-identifier hs-var">adts</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-787"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- First, attempt to grab the name of the class from the instance.</span><span>
</span><span id="line-788"></span><span>           </span><span class="hs-comment">-- This step could fail if the instance is not headed by a class,</span><span>
</span><span id="line-789"></span><span>           </span><span class="hs-comment">-- such as in the following examples:</span><span>
</span><span id="line-790"></span><span>           </span><span class="hs-comment">--</span><span>
</span><span id="line-791"></span><span>           </span><span class="hs-comment">-- (1) The class is headed by a bang pattern, such as in</span><span>
</span><span id="line-792"></span><span>           </span><span class="hs-comment">--     `instance !Show Int` (#3811c)</span><span>
</span><span id="line-793"></span><span>           </span><span class="hs-comment">-- (2) The class is headed by a type variable, such as in</span><span>
</span><span id="line-794"></span><span>           </span><span class="hs-comment">--     `instance c` (#16385)</span><span>
</span><span id="line-795"></span><span>           </span><span class="hs-comment">--</span><span>
</span><span id="line-796"></span><span>           </span><span class="hs-comment">-- If looking up the class name fails, then mb_cls_nm will</span><span>
</span><span id="line-797"></span><span>           </span><span class="hs-comment">-- be Nothing.</span><span>
</span><span id="line-798"></span><span>           </span><span id="local-6989586621681135822"><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135822"><span class="hs-identifier hs-var">mb_cls_nm</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
forall (m :: * -&gt; *) a. MaybeT m a -&gt; m (Maybe a)
</span><a href="../../transformers/src/Control.Monad.Trans.Maybe.html#runMaybeT"><span class="hs-identifier hs-var hs-var">runMaybeT</span></a></span><span> </span><span class="annot"><span class="annottext">(MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name))
-&gt; MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-799"></span><span>             </span><span class="hs-comment">-- See (1) above</span><span>
</span><span id="line-800"></span><span>             </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135820"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135820"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681135819"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135819"><span class="hs-identifier hs-var">cls_rdr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName))
-&gt; MaybeT
     (IOEnv (Env TcGblEnv TcLclEnv)) (GenLocated SrcSpan RdrName)
forall (m :: * -&gt; *) a. m (Maybe a) -&gt; MaybeT m a
</span><a href="../../transformers/src/Control.Monad.Trans.Maybe.html#MaybeT"><span class="hs-identifier hs-var">MaybeT</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName))
 -&gt; MaybeT
      (IOEnv (Env TcGblEnv TcLclEnv)) (GenLocated SrcSpan RdrName))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName))
-&gt; MaybeT
     (IOEnv (Env TcGblEnv TcLclEnv)) (GenLocated SrcSpan RdrName)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan RdrName)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName))
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (GenLocated SrcSpan RdrName)
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName)))
-&gt; Maybe (GenLocated SrcSpan RdrName)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (Maybe (GenLocated SrcSpan RdrName))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs -&gt; Maybe (Located (IdP GhcPs))
forall (p :: Pass).
LHsSigType (GhcPass p) -&gt; Maybe (Located (IdP (GhcPass p)))
</span><a href="GHC.Hs.Type.html#getLHsInstDeclClass_maybe"><span class="hs-identifier hs-var">getLHsInstDeclClass_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621681135825"><span class="hs-identifier hs-var">inst_ty</span></a></span><span>
</span><span id="line-801"></span><span>             </span><span class="hs-comment">-- See (2) above</span><span>
</span><span id="line-802"></span><span>             </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
-&gt; MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name
forall (m :: * -&gt; *) a. m (Maybe a) -&gt; MaybeT m a
</span><a href="../../transformers/src/Control.Monad.Trans.Maybe.html#MaybeT"><span class="hs-identifier hs-var">MaybeT</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
 -&gt; MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
-&gt; MaybeT (IOEnv (Env TcGblEnv TcLclEnv)) Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135820"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Maybe Name)
</span><a href="GHC.Rename.Env.html#lookupGlobalOccRn_maybe"><span class="hs-identifier hs-var">lookupGlobalOccRn_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135819"><span class="hs-identifier hs-var">cls_rdr</span></a></span><span>
</span><span id="line-803"></span><span>           </span><span class="hs-comment">-- Assuming the previous step succeeded, process any associated data</span><span>
</span><span id="line-804"></span><span>           </span><span class="hs-comment">-- family instances. If the previous step failed, bail out.</span><span>
</span><span id="line-805"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135822"><span class="hs-identifier hs-var">mb_cls_nm</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-806"></span><span>             </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([AvailInfo], [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-807"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135815"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135815"><span class="hs-identifier hs-var">cls_nm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-808"></span><span>               </span><span class="hs-special">(</span><span id="local-6989586621681135814"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135814"><span class="hs-identifier hs-var">avails</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135813"><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135813"><span class="hs-identifier hs-var">fldss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-809"></span><span>                 </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LDataFamInstDecl GhcPs
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])]))
-&gt; [LDataFamInstDecl GhcPs]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [[(Name, [FieldLabel])]])
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; m (b, c)) -&gt; [a] -&gt; m ([b], [c])
</span><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier hs-var">mapAndUnzipM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; Maybe Name
-&gt; LDataFamInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135812"><span class="hs-identifier hs-var">new_loc_di</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135829"><span class="hs-identifier hs-var">overload_ok</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Maybe Name
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135815"><span class="hs-identifier hs-var">cls_nm</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LDataFamInstDecl GhcPs]
</span><a href="#local-6989586621681135823"><span class="hs-identifier hs-var">adts</span></a></span><span>
</span><span id="line-810"></span><span>               </span><span class="annot"><span class="annottext">([AvailInfo], [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) ([AvailInfo], [(Name, [FieldLabel])])
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135814"><span class="hs-identifier hs-var">avails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]] -&gt; [(Name, [FieldLabel])]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[(Name, [FieldLabel])]]
</span><a href="#local-6989586621681135813"><span class="hs-identifier hs-var">fldss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-811"></span><span>
</span><span id="line-812"></span><span>    </span><span class="annot"><a href="#local-6989586621681135830"><span class="hs-identifier hs-type">new_di</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#DataFamInstDecl"><span class="hs-identifier hs-type">DataFamInstDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-813"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-814"></span><span>    </span><span id="local-6989586621681135830"><span class="annot"><span class="annottext">new_di :: Bool
-&gt; Maybe Name
-&gt; DataFamInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135830"><span class="hs-identifier hs-var hs-var">new_di</span></a></span></span><span> </span><span id="local-6989586621681135811"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135811"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span id="local-6989586621681135810"><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135810"><span class="hs-identifier hs-var">mb_cls</span></a></span></span><span> </span><span id="local-6989586621681135809"><span class="annot"><span class="annottext">dfid :: DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135809"><span class="hs-identifier hs-var">dfid</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#DataFamInstDecl"><span class="hs-identifier hs-type">DataFamInstDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dfid_eqn :: forall pass.
DataFamInstDecl pass -&gt; FamInstEqn pass (HsDataDefn pass)
</span><a href="GHC.Hs.Decls.html#dfid_eqn"><span class="hs-identifier hs-var">dfid_eqn</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-815"></span><span>                                     </span><span class="annot"><a href="GHC.Hs.Type.html#HsIB"><span class="hs-identifier hs-type">HsIB</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hsib_body :: forall pass thing. HsImplicitBndrs pass thing -&gt; thing
</span><a href="GHC.Hs.Type.html#hsib_body"><span class="hs-identifier hs-var">hsib_body</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135804"><span class="annot"><span class="annottext">FamEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621681135804"><span class="hs-identifier hs-var">ti_decl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-816"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135803"><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681135803"><span class="hs-identifier hs-var">main_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Name -&gt; GenLocated SrcSpan RdrName -&gt; RnM (Located Name)
</span><a href="GHC.Rename.Env.html#lookupFamInstName"><span class="hs-identifier hs-var">lookupFamInstName</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135810"><span class="hs-identifier hs-var">mb_cls</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamEqn GhcPs (HsDataDefn GhcPs) -&gt; Located (IdP GhcPs)
forall pass rhs. FamEqn pass rhs -&gt; Located (IdP pass)
</span><a href="GHC.Hs.Decls.html#feqn_tycon"><span class="hs-identifier hs-var hs-var">feqn_tycon</span></a></span><span> </span><span class="annot"><span class="annottext">FamEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621681135804"><span class="hs-identifier hs-var">ti_decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-817"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135800"><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135800"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135799"><span class="annot"><span class="annottext">[LFieldOcc GhcPs]
</span><a href="#local-6989586621681135799"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs -&gt; ([Located (IdP GhcPs)], [LFieldOcc GhcPs])
forall (p :: Pass).
IsPass p =&gt;
DataFamInstDecl (GhcPass p)
-&gt; ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
</span><a href="GHC.Hs.Utils.html#hsDataFamInstBinders"><span class="hs-identifier hs-var">hsDataFamInstBinders</span></a></span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135809"><span class="hs-identifier hs-var">dfid</span></a></span><span>
</span><span id="line-818"></span><span>             </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135797"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135797"><span class="hs-identifier hs-var">sub_names</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan RdrName -&gt; RnM Name)
-&gt; [GenLocated SrcSpan RdrName]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [Name]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName -&gt; RnM Name
</span><a href="GHC.Rename.Env.html#newTopSrcBinder"><span class="hs-identifier hs-var">newTopSrcBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan RdrName]
</span><a href="#local-6989586621681135800"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-819"></span><span>             </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135796"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135796"><span class="hs-identifier hs-var">flds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LFieldOcc GhcPs -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel)
-&gt; [LFieldOcc GhcPs] -&gt; IOEnv (Env TcGblEnv TcLclEnv) [FieldLabel]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; [Name]
-&gt; LFieldOcc GhcPs
-&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
</span><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier hs-var">newRecordSelector</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135811"><span class="hs-identifier hs-var">overload_ok</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135797"><span class="hs-identifier hs-var">sub_names</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LFieldOcc GhcPs]
</span><a href="#local-6989586621681135799"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-820"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135795"><span class="annot"><span class="annottext">avail :: AvailInfo
</span><a href="#local-6989586621681135795"><span class="hs-identifier hs-var hs-var">avail</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; Name
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681135803"><span class="hs-identifier hs-var">main_name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135797"><span class="hs-identifier hs-var">sub_names</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135796"><span class="hs-identifier hs-var">flds'</span></a></span><span>
</span><span id="line-821"></span><span>                                  </span><span class="hs-comment">-- main_name is not bound here!</span><span>
</span><span id="line-822"></span><span>                   </span><span id="local-6989586621681135794"><span class="annot"><span class="annottext">fld_env :: [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135794"><span class="hs-identifier hs-var hs-var">fld_env</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
-&gt; [Name] -&gt; [FieldLabel] -&gt; [(Name, [FieldLabel])]
</span><a href="#local-6989586621681135868"><span class="hs-identifier hs-var">mk_fld_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamEqn GhcPs (HsDataDefn GhcPs) -&gt; HsDataDefn GhcPs
forall pass rhs. FamEqn pass rhs -&gt; rhs
</span><a href="GHC.Hs.Decls.html#feqn_rhs"><span class="hs-identifier hs-var hs-var">feqn_rhs</span></a></span><span> </span><span class="annot"><span class="annottext">FamEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621681135804"><span class="hs-identifier hs-var">ti_decl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135797"><span class="hs-identifier hs-var">sub_names</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135796"><span class="hs-identifier hs-var">flds'</span></a></span><span>
</span><span id="line-823"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(AvailInfo, [(Name, [FieldLabel])])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135795"><span class="hs-identifier hs-var">avail</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(Name, [FieldLabel])]
</span><a href="#local-6989586621681135794"><span class="hs-identifier hs-var">fld_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-824"></span><span>
</span><span id="line-825"></span><span>    </span><span class="annot"><a href="#local-6989586621681135812"><span class="hs-identifier hs-type">new_loc_di</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#LDataFamInstDecl"><span class="hs-identifier hs-type">LDataFamInstDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-826"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-827"></span><span>    </span><span id="local-6989586621681135812"><span class="annot"><span class="annottext">new_loc_di :: Bool
-&gt; Maybe Name
-&gt; LDataFamInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135812"><span class="hs-identifier hs-var hs-var">new_loc_di</span></a></span></span><span> </span><span id="local-6989586621681135792"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135792"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span id="local-6989586621681135791"><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135791"><span class="hs-identifier hs-var">mb_cls</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135790"><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135790"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Maybe Name
-&gt; DataFamInstDecl GhcPs
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv) (AvailInfo, [(Name, [FieldLabel])])
</span><a href="#local-6989586621681135830"><span class="hs-identifier hs-var">new_di</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135792"><span class="hs-identifier hs-var">overload_ok</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135791"><span class="hs-identifier hs-var">mb_cls</span></a></span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621681135790"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-828"></span><span>
</span><span id="line-829"></span><span class="annot"><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier hs-type">newRecordSelector</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#LFieldOcc"><span class="hs-identifier hs-type">LFieldOcc</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span>
</span><span id="line-830"></span><span id="newRecordSelector"><span class="annot"><span class="annottext">newRecordSelector :: Bool
-&gt; [Name]
-&gt; LFieldOcc GhcPs
-&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
</span><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier hs-var hs-var">newRecordSelector</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">LFieldOcc GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newRecordSelector: datatype has no constructors!&quot;</span></span><span>
</span><span id="line-831"></span><span class="annot"><a href="GHC.Rename.Names.html#newRecordSelector"><span class="hs-identifier hs-var">newRecordSelector</span></a></span><span> </span><span id="local-6989586621681135788"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135788"><span class="hs-identifier hs-var">overload_ok</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135787"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135787"><span class="hs-identifier hs-var">dc</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Name]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135786"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135786"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#FieldOcc"><span class="hs-identifier hs-type">FieldOcc</span></a></span><span> </span><span class="annot"><span class="annottext">XCFieldOcc GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135785"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135785"><span class="hs-identifier hs-var">fld</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-832"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135784"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135784"><span class="hs-identifier hs-var">selName</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan RdrName -&gt; RnM Name
</span><a href="GHC.Rename.Env.html#newTopSrcBinder"><span class="hs-identifier hs-var">newTopSrcBinder</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan RdrName -&gt; RnM Name)
-&gt; GenLocated SrcSpan RdrName -&gt; RnM Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; RdrName -&gt; GenLocated SrcSpan RdrName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135786"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; GenLocated SrcSpan RdrName)
-&gt; RdrName -&gt; GenLocated SrcSpan RdrName
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135783"><span class="hs-identifier hs-var">field</span></a></span><span>
</span><span id="line-833"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(FieldLabel -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel)
-&gt; FieldLabel -&gt; IOEnv (Env TcGblEnv TcLclEnv) FieldLabel
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl OccName
</span><a href="#local-6989586621681135782"><span class="hs-identifier hs-var">qualFieldLbl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">flSelector :: Name
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var">flSelector</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135784"><span class="hs-identifier hs-var">selName</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-834"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-835"></span><span>    </span><span id="local-6989586621681135780"><span class="annot"><span class="annottext">fieldOccName :: FastString
</span><a href="#local-6989586621681135780"><span class="hs-identifier hs-var hs-var">fieldOccName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString) -&gt; OccName -&gt; FastString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135785"><span class="hs-identifier hs-var">fld</span></a></span><span>
</span><span id="line-836"></span><span>    </span><span id="local-6989586621681135782"><span class="annot"><span class="annottext">qualFieldLbl :: FieldLbl OccName
</span><a href="#local-6989586621681135782"><span class="hs-identifier hs-var hs-var">qualFieldLbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; OccName -&gt; Bool -&gt; FieldLbl OccName
</span><a href="GHC.Types.FieldLabel.html#mkFieldLabelOccs"><span class="hs-identifier hs-var">mkFieldLabelOccs</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681135780"><span class="hs-identifier hs-var">fieldOccName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135787"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135788"><span class="hs-identifier hs-var">overload_ok</span></a></span><span>
</span><span id="line-837"></span><span>    </span><span id="local-6989586621681135783"><span class="annot"><span class="annottext">field :: RdrName
</span><a href="#local-6989586621681135783"><span class="hs-identifier hs-var hs-var">field</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isExact"><span class="hs-identifier hs-var">isExact</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135785"><span class="hs-identifier hs-var">fld</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135785"><span class="hs-identifier hs-var">fld</span></a></span><span>
</span><span id="line-838"></span><span>              </span><span class="hs-comment">-- use an Exact RdrName as is to preserve the bindings</span><span>
</span><span id="line-839"></span><span>              </span><span class="hs-comment">-- of an already renamer-resolved field and its use</span><span>
</span><span id="line-840"></span><span>              </span><span class="hs-comment">-- sites. This is needed to correctly support record</span><span>
</span><span id="line-841"></span><span>              </span><span class="hs-comment">-- selectors in Template Haskell. See Note [Binders in</span><span>
</span><span id="line-842"></span><span>              </span><span class="hs-comment">-- Template Haskell] in &quot;GHC.ThToHs&quot; and Note [Looking up</span><span>
</span><span id="line-843"></span><span>              </span><span class="hs-comment">-- Exact RdrNames] in &quot;GHC.Rename.Env&quot;.</span><span>
</span><span id="line-844"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; RdrName
</span><a href="GHC.Types.Name.Reader.html#mkRdrUnqual"><span class="hs-identifier hs-var">mkRdrUnqual</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FieldLbl OccName -&gt; OccName
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl OccName
</span><a href="#local-6989586621681135782"><span class="hs-identifier hs-var">qualFieldLbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-845"></span><span>
</span><span id="line-846"></span><span class="hs-comment">{-
Note [Looking up family names in family instances]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider

  module M where
    type family T a :: *
    type instance M.T Int = Bool

We might think that we can simply use 'lookupOccRn' when processing the type
instance to look up 'M.T'.  Alas, we can't!  The type family declaration is in
the *same* HsGroup as the type instance declaration.  Hence, as we are
currently collecting the binders declared in that HsGroup, these binders will
not have been added to the global environment yet.

Solution is simple: process the type family declarations first, extend
the environment, and then process the type instances.


************************************************************************
*                                                                      *
\subsection{Filtering imports}
*                                                                      *
************************************************************************

@filterImports@ takes the @ExportEnv@ telling what the imported module makes
available, and filters it through the import spec (if any).

Note [Dealing with imports]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
For import M( ies ), we take the mi_exports of M, and make
   imp_occ_env :: OccEnv (Name, AvailInfo, Maybe Name)
One entry for each Name that M exports; the AvailInfo is the
AvailInfo exported from M that exports that Name.

The situation is made more complicated by associated types. E.g.
   module M where
     class    C a    where { data T a }
     instance C Int  where { data T Int = T1 | T2 }
     instance C Bool where { data T Int = T3 }
Then M's export_avails are (recall the AvailTC invariant from Avails.hs)
  C(C,T), T(T,T1,T2,T3)
Notice that T appears *twice*, once as a child and once as a parent. From
this list we construct a raw list including
   T -&gt; (T, T( T1, T2, T3 ), Nothing)
   T -&gt; (C, C( C, T ),       Nothing)
and we combine these (in function 'combine' in 'imp_occ_env' in
'filterImports') to get
   T  -&gt; (T,  T(T,T1,T2,T3), Just C)

So the overall imp_occ_env is
   C  -&gt; (C,  C(C,T),        Nothing)
   T  -&gt; (T,  T(T,T1,T2,T3), Just C)
   T1 -&gt; (T1, T(T,T1,T2,T3), Nothing)   -- similarly T2,T3

If we say
   import M( T(T1,T2) )
then we get *two* Avails:  C(T), T(T1,T2)

Note that the imp_occ_env will have entries for data constructors too,
although we never look up data constructors.
-}</span><span>
</span><span id="line-908"></span><span>
</span><span id="line-909"></span><span class="annot"><a href="GHC.Rename.Names.html#filterImports"><span class="hs-identifier hs-type">filterImports</span></a></span><span>
</span><span id="line-910"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span>
</span><span id="line-911"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span>                     </span><span class="hs-comment">-- The span for the entire import decl</span><span>
</span><span id="line-912"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>    </span><span class="hs-comment">-- Import spec; True =&gt; hiding</span><span>
</span><span id="line-913"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Import spec w/ Names</span><span>
</span><span id="line-914"></span><span>            </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>                   </span><span class="hs-comment">-- Same again, but in GRE form</span><span>
</span><span id="line-915"></span><span id="filterImports"><span class="annot"><span class="annottext">filterImports :: ModIface
-&gt; ImpDeclSpec
-&gt; Maybe (Bool, Located [LIE GhcPs])
-&gt; RnM (Maybe (Bool, Located [LIE GhcRn]), [GlobalRdrElt])
</span><a href="GHC.Rename.Names.html#filterImports"><span class="hs-identifier hs-var hs-var">filterImports</span></a></span></span><span> </span><span id="local-6989586621681135776"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135776"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135775"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135775"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-916"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe (Bool, Located [LIE GhcRn]), [GlobalRdrElt])
-&gt; RnM (Maybe (Bool, Located [LIE GhcRn]), [GlobalRdrElt])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcRn])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportSpec -&gt; Maybe ImportSpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ImportSpec
</span><a href="#local-6989586621681135774"><span class="hs-identifier hs-var">imp_spec</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135776"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-917"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-918"></span><span>    </span><span id="local-6989586621681135774"><span class="annot"><span class="annottext">imp_spec :: ImportSpec
</span><a href="#local-6989586621681135774"><span class="hs-identifier hs-var hs-var">imp_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpSpec :: ImpDeclSpec -&gt; ImpItemSpec -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSpec"><span class="hs-identifier hs-type">ImpSpec</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_decl :: ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#is_decl"><span class="hs-identifier hs-var">is_decl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135775"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_item :: ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#is_item"><span class="hs-identifier hs-var">is_item</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#ImpAll"><span class="hs-identifier hs-var">ImpAll</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-919"></span><span>
</span><span id="line-920"></span><span>
</span><span id="line-921"></span><span class="annot"><a href="GHC.Rename.Names.html#filterImports"><span class="hs-identifier hs-var">filterImports</span></a></span><span> </span><span id="local-6989586621681135768"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135768"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135767"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135767"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135766"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135766"><span class="hs-identifier hs-var">want_hiding</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135765"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135765"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135764"><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621681135764"><span class="hs-identifier hs-var">import_items</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-922"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-comment">-- check for errors, convert RdrNames to Names</span><span>
</span><span id="line-923"></span><span>        </span><span id="local-6989586621681135763"><span class="annot"><span class="annottext">[[(LIE GhcRn, AvailInfo)]]
</span><a href="#local-6989586621681135763"><span class="hs-identifier hs-var">items1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LIE GhcPs
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) [(LIE GhcRn, AvailInfo)])
-&gt; [LIE GhcPs]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [[(LIE GhcRn, AvailInfo)]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; IOEnv (Env TcGblEnv TcLclEnv) [(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135762"><span class="hs-identifier hs-var">lookup_lie</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621681135764"><span class="hs-identifier hs-var">import_items</span></a></span><span>
</span><span id="line-924"></span><span>
</span><span id="line-925"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681135761"><span class="hs-identifier hs-type">items2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-926"></span><span>            </span><span id="local-6989586621681135761"><span class="annot"><span class="annottext">items2 :: [(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135761"><span class="hs-identifier hs-var hs-var">items2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[(LIE GhcRn, AvailInfo)]] -&gt; [(LIE GhcRn, AvailInfo)]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[(LIE GhcRn, AvailInfo)]]
</span><a href="#local-6989586621681135763"><span class="hs-identifier hs-var">items1</span></a></span><span>
</span><span id="line-927"></span><span>                </span><span class="hs-comment">-- NB the AvailInfo may have duplicates, and several items</span><span>
</span><span id="line-928"></span><span>                </span><span class="hs-comment">--    for the same parent; e.g N(x) and N(y)</span><span>
</span><span id="line-929"></span><span>
</span><span id="line-930"></span><span>            </span><span id="local-6989586621681135760"><span class="annot"><span class="annottext">names :: Defs
</span><a href="#local-6989586621681135760"><span class="hs-identifier hs-var hs-var">names</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; Defs
</span><a href="GHC.Types.Avail.html#availsToNameSetWithSelectors"><span class="hs-identifier hs-var">availsToNameSetWithSelectors</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((LIE GhcRn, AvailInfo) -&gt; AvailInfo)
-&gt; [(LIE GhcRn, AvailInfo)] -&gt; [AvailInfo]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(LIE GhcRn, AvailInfo) -&gt; AvailInfo
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135761"><span class="hs-identifier hs-var">items2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-931"></span><span>            </span><span id="local-6989586621681135759"><span class="annot"><span class="annottext">keep :: Name -&gt; Bool
</span><a href="#local-6989586621681135759"><span class="hs-identifier hs-var hs-var">keep</span></a></span></span><span> </span><span id="local-6989586621681135758"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135758"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135758"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135760"><span class="hs-identifier hs-var">names</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-932"></span><span>            </span><span id="local-6989586621681135756"><span class="annot"><span class="annottext">pruned_avails :: [AvailInfo]
</span><a href="#local-6989586621681135756"><span class="hs-identifier hs-var hs-var">pruned_avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [AvailInfo] -&gt; [AvailInfo]
</span><a href="GHC.Types.Avail.html#filterAvails"><span class="hs-identifier hs-var">filterAvails</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681135759"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135754"><span class="hs-identifier hs-var">all_avails</span></a></span><span>
</span><span id="line-933"></span><span>            </span><span id="local-6989586621681135753"><span class="annot"><span class="annottext">hiding_spec :: ImportSpec
</span><a href="#local-6989586621681135753"><span class="hs-identifier hs-var hs-var">hiding_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpSpec :: ImpDeclSpec -&gt; ImpItemSpec -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSpec"><span class="hs-identifier hs-type">ImpSpec</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_decl :: ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#is_decl"><span class="hs-identifier hs-var">is_decl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135767"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_item :: ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#is_item"><span class="hs-identifier hs-var">is_item</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#ImpAll"><span class="hs-identifier hs-var">ImpAll</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-934"></span><span>
</span><span id="line-935"></span><span>            </span><span id="local-6989586621681135752"><span class="annot"><span class="annottext">gres :: [GlobalRdrElt]
</span><a href="#local-6989586621681135752"><span class="hs-identifier hs-var hs-var">gres</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135766"><span class="hs-identifier hs-var">want_hiding</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportSpec -&gt; Maybe ImportSpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ImportSpec
</span><a href="#local-6989586621681135753"><span class="hs-identifier hs-var">hiding_spec</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135756"><span class="hs-identifier hs-var">pruned_avails</span></a></span><span>
</span><span id="line-936"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((LIE GhcRn, AvailInfo) -&gt; [GlobalRdrElt])
-&gt; [(LIE GhcRn, AvailInfo)] -&gt; [GlobalRdrElt]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; (LIE GhcRn, AvailInfo) -&gt; [GlobalRdrElt]
</span><a href="GHC.Rename.Names.html#gresFromIE"><span class="hs-identifier hs-var">gresFromIE</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135767"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135761"><span class="hs-identifier hs-var">items2</span></a></span><span>
</span><span id="line-937"></span><span>
</span><span id="line-938"></span><span>        </span><span class="annot"><span class="annottext">(Maybe (Bool, Located [LIE GhcRn]), [GlobalRdrElt])
-&gt; RnM (Maybe (Bool, Located [LIE GhcRn]), [GlobalRdrElt])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Bool, Located [LIE GhcRn]) -&gt; Maybe (Bool, Located [LIE GhcRn])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135766"><span class="hs-identifier hs-var">want_hiding</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; [LIE GhcRn] -&gt; Located [LIE GhcRn]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135765"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((LIE GhcRn, AvailInfo) -&gt; LIE GhcRn)
-&gt; [(LIE GhcRn, AvailInfo)] -&gt; [LIE GhcRn]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(LIE GhcRn, AvailInfo) -&gt; LIE GhcRn
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135761"><span class="hs-identifier hs-var">items2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135752"><span class="hs-identifier hs-var">gres</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-939"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-940"></span><span>    </span><span id="local-6989586621681135754"><span class="annot"><span class="annottext">all_avails :: [AvailInfo]
</span><a href="#local-6989586621681135754"><span class="hs-identifier hs-var hs-var">all_avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135768"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-941"></span><span>
</span><span id="line-942"></span><span>        </span><span class="hs-comment">-- See Note [Dealing with imports]</span><span>
</span><span id="line-943"></span><span>    </span><span class="annot"><a href="#local-6989586621681135750"><span class="hs-identifier hs-type">imp_occ_env</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccEnv"><span class="hs-identifier hs-type">OccEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- the name</span><span>
</span><span id="line-944"></span><span>                           </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- the export item providing the name</span><span>
</span><span id="line-945"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- the parent of associated types</span><span>
</span><span id="line-946"></span><span>    </span><span id="local-6989586621681135750"><span class="annot"><span class="annottext">imp_occ_env :: OccEnv (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135750"><span class="hs-identifier hs-var hs-var">imp_occ_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Name, AvailInfo, Maybe Name)
 -&gt; (Name, AvailInfo, Maybe Name) -&gt; (Name, AvailInfo, Maybe Name))
-&gt; [(OccName, (Name, AvailInfo, Maybe Name))]
-&gt; OccEnv (Name, AvailInfo, Maybe Name)
forall a. (a -&gt; a -&gt; a) -&gt; [(OccName, a)] -&gt; OccEnv a
</span><a href="GHC.Types.Name.Occurrence.html#mkOccEnv_C"><span class="hs-identifier hs-var">mkOccEnv_C</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
-&gt; (Name, AvailInfo, Maybe Name) -&gt; (Name, AvailInfo, Maybe Name)
forall {a} {a}.
(Outputable a, Outputable a) =&gt;
(Name, AvailInfo, Maybe a)
-&gt; (Name, AvailInfo, Maybe a) -&gt; (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135748"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135747"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135746"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135745"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Name
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-947"></span><span>                                     </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681135745"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135745"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135754"><span class="hs-identifier hs-var">all_avails</span></a></span><span>
</span><span id="line-948"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135746"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135746"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135747"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135747"><span class="hs-identifier hs-var">occ</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [(Name, OccName)]
</span><a href="GHC.Types.Avail.html#availNamesWithOccs"><span class="hs-identifier hs-var">availNamesWithOccs</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135745"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-949"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-950"></span><span>        </span><span class="hs-comment">-- See Note [Dealing with imports]</span><span>
</span><span id="line-951"></span><span>        </span><span class="hs-comment">-- 'combine' is only called for associated data types which appear</span><span>
</span><span id="line-952"></span><span>        </span><span class="hs-comment">-- twice in the all_avails. In the example, we combine</span><span>
</span><span id="line-953"></span><span>        </span><span class="hs-comment">--    T(T,T1,T2,T3) and C(C,T)  to give   (T, T(T,T1,T2,T3), Just C)</span><span>
</span><span id="line-954"></span><span>        </span><span class="hs-comment">-- NB: the AvailTC can have fields as well as data constructors (#12127)</span><span>
</span><span id="line-955"></span><span>        </span><span id="local-6989586621681135748"><span class="annot"><span class="annottext">combine :: (Name, AvailInfo, Maybe a)
-&gt; (Name, AvailInfo, Maybe a) -&gt; (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135748"><span class="hs-identifier hs-var hs-var">combine</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135726"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135726"><span class="hs-identifier hs-var">name1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135725"><span class="annot"><span class="annottext">a1 :: AvailInfo
</span><a href="#local-6989586621681135725"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135724"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135724"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135723"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681135723"><span class="hs-identifier hs-var">mp1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-956"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621681135722"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135722"><span class="hs-identifier hs-var">name2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135721"><span class="annot"><span class="annottext">a2 :: AvailInfo
</span><a href="#local-6989586621681135721"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135720"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135720"><span class="hs-identifier hs-var">p2</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135719"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681135719"><span class="hs-identifier hs-var">mp2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-957"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">name1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">name2</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">isNothing</span><span> </span><span class="hs-identifier">mp1</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">isNothing</span><span> </span><span class="hs-identifier">mp2</span><span>
</span><span id="line-958"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">name1</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">name2</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">mp1</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">mp2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-959"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135724"><span class="hs-identifier hs-var">p1</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135726"><span class="hs-identifier hs-var">name1</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135726"><span class="hs-identifier hs-var">name1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135725"><span class="hs-identifier hs-var">a1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Name
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135720"><span class="hs-identifier hs-var">p2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-960"></span><span>                           </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135726"><span class="hs-identifier hs-var">name1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135721"><span class="hs-identifier hs-var">a2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Name
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135724"><span class="hs-identifier hs-var">p1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-961"></span><span>        </span><span class="annot"><a href="#local-6989586621681135748"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span id="local-6989586621681135717"><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a)
</span><a href="#local-6989586621681135717"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681135716"><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a)
</span><a href="#local-6989586621681135716"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; (Name, AvailInfo, Maybe Name)
forall a. HasCallStack =&gt; String -&gt; MsgDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;filterImports/combine&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a) -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a)
</span><a href="#local-6989586621681135717"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a) -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe a)
</span><a href="#local-6989586621681135716"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-962"></span><span>
</span><span id="line-963"></span><span>    </span><span class="annot"><a href="#local-6989586621681135713"><span class="hs-identifier hs-type">lookup_name</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-964"></span><span>    </span><span id="local-6989586621681135713"><span class="annot"><span class="annottext">lookup_name :: IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var hs-var">lookup_name</span></a></span></span><span> </span><span id="local-6989586621681135712"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135712"><span class="hs-identifier hs-var">ie</span></a></span></span><span> </span><span id="local-6989586621681135711"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135711"><span class="hs-identifier hs-var">rdr</span></a></span></span><span>
</span><span id="line-965"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isQual"><span class="hs-identifier hs-var">isQual</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135711"><span class="hs-identifier hs-var">rdr</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IELookupError -&gt; IELookupM (Name, AvailInfo, Maybe Name)
forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var">failLookupWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; IELookupError
</span><a href="GHC.Rename.Names.html#QualImportError"><span class="hs-identifier hs-var">QualImportError</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135711"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-966"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135707"><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135707"><span class="hs-identifier hs-var">succ</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135706"><span class="hs-identifier hs-var">mb_success</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
-&gt; IELookupM (Name, AvailInfo, Maybe Name)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135707"><span class="hs-identifier hs-var">succ</span></a></span><span>
</span><span id="line-967"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IELookupError -&gt; IELookupM (Name, AvailInfo, Maybe Name)
forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var">failLookupWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; IELookupError
</span><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-var">BadImport</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135712"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-968"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-969"></span><span>        </span><span id="local-6989586621681135706"><span class="annot"><span class="annottext">mb_success :: Maybe (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135706"><span class="hs-identifier hs-var hs-var">mb_success</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccEnv (Name, AvailInfo, Maybe Name)
-&gt; OccName -&gt; Maybe (Name, AvailInfo, Maybe Name)
forall a. OccEnv a -&gt; OccName -&gt; Maybe a
</span><a href="GHC.Types.Name.Occurrence.html#lookupOccEnv"><span class="hs-identifier hs-var">lookupOccEnv</span></a></span><span> </span><span class="annot"><span class="annottext">OccEnv (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135750"><span class="hs-identifier hs-var">imp_occ_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135711"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span>
</span><span id="line-971"></span><span>    </span><span class="annot"><a href="#local-6989586621681135762"><span class="hs-identifier hs-type">lookup_lie</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-972"></span><span>    </span><span id="local-6989586621681135762"><span class="annot"><span class="annottext">lookup_lie :: LIE GhcPs -&gt; IOEnv (Env TcGblEnv TcLclEnv) [(LIE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135762"><span class="hs-identifier hs-var hs-var">lookup_lie</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135703"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135703"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681135702"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135702"><span class="hs-identifier hs-var">ieRdr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-973"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135701"><span class="annot"><span class="annottext">[(IE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135701"><span class="hs-identifier hs-var">stuff</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135700"><span class="annot"><span class="annottext">[IELookupWarning]
</span><a href="#local-6989586621681135700"><span class="hs-identifier hs-var">warns</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135703"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
 -&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-974"></span><span>                               </span><span class="annot"><span class="annottext">(Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning])
 -&gt; ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv
   (Env TcGblEnv TcLclEnv)
   (Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
 -&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; TcRn ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-975"></span><span>                               </span><span class="annot"><span class="annottext">IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (Maybe ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
forall a. IELookupM a -&gt; TcRn (Maybe a)
</span><a href="#local-6989586621681135697"><span class="hs-identifier hs-var">run_lookup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135696"><span class="hs-identifier hs-var">lookup_ie</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135702"><span class="hs-identifier hs-var">ieRdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-976"></span><span>             </span><span class="annot"><span class="annottext">(IELookupWarning -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; [IELookupWarning] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupWarning -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135694"><span class="hs-identifier hs-var">emit_warning</span></a></span><span> </span><span class="annot"><span class="annottext">[IELookupWarning]
</span><a href="#local-6989586621681135700"><span class="hs-identifier hs-var">warns</span></a></span><span>
</span><span id="line-977"></span><span>             </span><span class="annot"><span class="annottext">[(LIE GhcRn, AvailInfo)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [(LIE GhcRn, AvailInfo)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; IE GhcRn -&gt; LIE GhcRn
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135703"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135693"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135692"><span class="hs-identifier hs-var">avail</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135693"><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135693"><span class="hs-identifier hs-var">ie</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681135692"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135692"><span class="hs-identifier hs-var">avail</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(IE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135701"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-978"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-979"></span><span>            </span><span class="hs-comment">-- Warn when importing T(..) if T was exported abstractly</span><span>
</span><span id="line-980"></span><span>            </span><span id="local-6989586621681135694"><span class="annot"><span class="annottext">emit_warning :: IELookupWarning -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135694"><span class="hs-identifier hs-var hs-var">emit_warning</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Rename.Names.html#DodgyImport"><span class="hs-identifier hs-type">DodgyImport</span></a></span><span> </span><span id="local-6989586621681135690"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135690"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnDodgyImports"><span class="hs-identifier hs-var">Opt_WarnDodgyImports</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-981"></span><span>              </span><span class="annot"><span class="annottext">WarnReason -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarn"><span class="hs-identifier hs-var">addWarn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnDodgyImports"><span class="hs-identifier hs-var">Opt_WarnDodgyImports</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#dodgyImportWarn"><span class="hs-identifier hs-var">dodgyImportWarn</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135690"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-982"></span><span>            </span><span class="annot"><a href="#local-6989586621681135694"><span class="hs-identifier hs-var">emit_warning</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupWarning
</span><a href="GHC.Rename.Names.html#MissingImportList"><span class="hs-identifier hs-var">MissingImportList</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingImportList"><span class="hs-identifier hs-var">Opt_WarnMissingImportList</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-983"></span><span>              </span><span class="annot"><span class="annottext">WarnReason -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarn"><span class="hs-identifier hs-var">addWarn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingImportList"><span class="hs-identifier hs-var">Opt_WarnMissingImportList</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#missingImportListItem"><span class="hs-identifier hs-var">missingImportListItem</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135702"><span class="hs-identifier hs-var">ieRdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-984"></span><span>            </span><span class="annot"><a href="#local-6989586621681135694"><span class="hs-identifier hs-var">emit_warning</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Rename.Names.html#BadImportW"><span class="hs-identifier hs-type">BadImportW</span></a></span><span> </span><span id="local-6989586621681135684"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135684"><span class="hs-identifier hs-var">ie</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnDodgyImports"><span class="hs-identifier hs-var">Opt_WarnDodgyImports</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-985"></span><span>              </span><span class="annot"><span class="annottext">WarnReason -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarn"><span class="hs-identifier hs-var">addWarn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnDodgyImports"><span class="hs-identifier hs-var">Opt_WarnDodgyImports</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IELookupError -&gt; MsgDoc
</span><a href="#local-6989586621681135683"><span class="hs-identifier hs-var">lookup_err_msg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; IELookupError
</span><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-var">BadImport</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135684"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span>            </span><span id="local-6989586621681136781"><span class="annot"><a href="#local-6989586621681135697"><span class="hs-identifier hs-type">run_lookup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136781"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136781"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-988"></span><span>            </span><span id="local-6989586621681135697"><span class="annot"><span class="annottext">run_lookup :: forall a. IELookupM a -&gt; TcRn (Maybe a)
</span><a href="#local-6989586621681135697"><span class="hs-identifier hs-var hs-var">run_lookup</span></a></span></span><span> </span><span id="local-6989586621681135679"><span class="annot"><span class="annottext">IELookupM a
</span><a href="#local-6989586621681135679"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IELookupM a
</span><a href="#local-6989586621681135679"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-989"></span><span>              </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Failed</span></a></span><span> </span><span id="local-6989586621681135677"><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135677"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IELookupError -&gt; MsgDoc
</span><a href="#local-6989586621681135683"><span class="hs-identifier hs-var">lookup_err_msg</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135677"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; TcRn (Maybe a) -&gt; TcRn (Maybe a)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; TcRn (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-990"></span><span>              </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span id="local-6989586621681135675"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135675"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; TcRn (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135675"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-991"></span><span>
</span><span id="line-992"></span><span>            </span><span id="local-6989586621681135683"><span class="annot"><span class="annottext">lookup_err_msg :: IELookupError -&gt; MsgDoc
</span><a href="#local-6989586621681135683"><span class="hs-identifier hs-var hs-var">lookup_err_msg</span></a></span></span><span> </span><span id="local-6989586621681135674"><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135674"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135674"><span class="hs-identifier hs-var">err</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-993"></span><span>              </span><span class="annot"><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-type">BadImport</span></a></span><span> </span><span id="local-6989586621681135673"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135673"><span class="hs-identifier hs-var">ie</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; [AvailInfo] -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErr"><span class="hs-identifier hs-var">badImportItemErr</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135768"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135767"><span class="hs-identifier hs-var">decl_spec</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135673"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135754"><span class="hs-identifier hs-var">all_avails</span></a></span><span>
</span><span id="line-994"></span><span>              </span><span class="annot"><span class="annottext">IELookupError
</span><a href="GHC.Rename.Names.html#IllegalImport"><span class="hs-identifier hs-var">IllegalImport</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Rename.Names.html#illegalImportItemErr"><span class="hs-identifier hs-var">illegalImportItemErr</span></a></span><span>
</span><span id="line-995"></span><span>              </span><span class="annot"><a href="GHC.Rename.Names.html#QualImportError"><span class="hs-identifier hs-type">QualImportError</span></a></span><span> </span><span id="local-6989586621681135669"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135669"><span class="hs-identifier hs-var">rdr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#qualImportItemErr"><span class="hs-identifier hs-var">qualImportItemErr</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135669"><span class="hs-identifier hs-var">rdr</span></a></span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span>        </span><span class="hs-comment">-- For each import item, we convert its RdrNames to Names,</span><span>
</span><span id="line-998"></span><span>        </span><span class="hs-comment">-- and at the same time construct an AvailInfo corresponding</span><span>
</span><span id="line-999"></span><span>        </span><span class="hs-comment">-- to what is actually imported by this item.</span><span>
</span><span id="line-1000"></span><span>        </span><span class="hs-comment">-- Returns Nothing on error.</span><span>
</span><span id="line-1001"></span><span>        </span><span class="hs-comment">-- We return a list here, because in the case of an import</span><span>
</span><span id="line-1002"></span><span>        </span><span class="hs-comment">-- item like C, if we are hiding, then C refers to *both* a</span><span>
</span><span id="line-1003"></span><span>        </span><span class="hs-comment">-- type/class and a data constructor.  Moreover, when we import</span><span>
</span><span id="line-1004"></span><span>        </span><span class="hs-comment">-- data constructors of an associated family, we need separate</span><span>
</span><span id="line-1005"></span><span>        </span><span class="hs-comment">-- AvailInfos for the data constructors and the family (as they have</span><span>
</span><span id="line-1006"></span><span>        </span><span class="hs-comment">-- different parents).  See Note [Dealing with imports]</span><span>
</span><span id="line-1007"></span><span>    </span><span class="annot"><a href="#local-6989586621681135696"><span class="hs-identifier hs-type">lookup_ie</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-1008"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#IELookupWarning"><span class="hs-identifier hs-type">IELookupWarning</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1009"></span><span>    </span><span id="local-6989586621681135696"><span class="annot"><span class="annottext">lookup_ie :: IE GhcPs -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135696"><span class="hs-identifier hs-var hs-var">lookup_ie</span></a></span></span><span> </span><span id="local-6989586621681135667"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135666"><span class="hs-identifier hs-var">handle_bad_import</span></a></span><span> </span><span class="annot"><span class="annottext">(IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
 -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1010"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1011"></span><span>        </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEVar"><span class="hs-identifier hs-type">IEVar</span></a></span><span> </span><span class="annot"><span class="annottext">XIEVar GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135664"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135664"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135663"><span class="annot"><span class="annottext">IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135663"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1012"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681135662"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135662"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135661"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135661"><span class="hs-identifier hs-var">avail</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var">lookup_name</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name))
-&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135663"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1013"></span><span>            </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEVar GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass. XIEVar pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEVar"><span class="hs-identifier hs-var">IEVar</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEVar GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135664"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; Name -&gt; IEWrappedName Name
forall name1 name2.
IEWrappedName name1 -&gt; name2 -&gt; IEWrappedName name2
</span><a href="GHC.Hs.ImpExp.html#replaceWrappedName"><span class="hs-identifier hs-var">replaceWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135663"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135662"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1014"></span><span>                                                  </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#trimAvail"><span class="hs-identifier hs-var">trimAvail</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135661"><span class="hs-identifier hs-var">avail</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135662"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1015"></span><span>
</span><span id="line-1016"></span><span>        </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-type">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingAll GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135655"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135655"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135654"><span class="annot"><span class="annottext">IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135654"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1017"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681135653"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135653"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135652"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135652"><span class="hs-identifier hs-var">avail</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135651"><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135651"><span class="hs-identifier hs-var">mb_parent</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var">lookup_name</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name))
-&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135654"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1018"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135650"><span class="annot"><span class="annottext">warns :: [IELookupWarning]
</span><a href="#local-6989586621681135650"><span class="hs-identifier hs-var hs-var">warns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135652"><span class="hs-identifier hs-var">avail</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1019"></span><span>                          </span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>                     </span><span class="hs-comment">-- e.g. f(..)</span><span>
</span><span id="line-1020"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RdrName -&gt; IELookupWarning
</span><a href="GHC.Rename.Names.html#DodgyImport"><span class="hs-identifier hs-var">DodgyImport</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; IELookupWarning) -&gt; RdrName -&gt; IELookupWarning
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135654"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1021"></span><span>
</span><span id="line-1022"></span><span>                          </span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135648"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135648"><span class="hs-identifier hs-var">subs</span></a></span></span><span> </span><span id="local-6989586621681135647"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135647"><span class="hs-identifier hs-var">fs</span></a></span></span><span>
</span><span id="line-1023"></span><span>                            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [Name] -&gt; [Name]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135648"><span class="hs-identifier hs-var">subs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135647"><span class="hs-identifier hs-var">fs</span></a></span><span> </span><span class="hs-comment">-- e.g. T(..) where T is a synonym</span><span>
</span><span id="line-1024"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RdrName -&gt; IELookupWarning
</span><a href="GHC.Rename.Names.html#DodgyImport"><span class="hs-identifier hs-var">DodgyImport</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; IELookupWarning) -&gt; RdrName -&gt; IELookupWarning
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135654"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1025"></span><span>
</span><span id="line-1026"></span><span>                            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#is_qual"><span class="hs-identifier hs-var hs-var">is_qual</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135767"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- e.g. import M( T(..) )</span><span>
</span><span id="line-1027"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">IELookupWarning
</span><a href="GHC.Rename.Names.html#MissingImportList"><span class="hs-identifier hs-var">MissingImportList</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1028"></span><span>
</span><span id="line-1029"></span><span>                            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1030"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1031"></span><span>
</span><span id="line-1032"></span><span>                </span><span id="local-6989586621681135645"><span class="annot"><span class="annottext">renamed_ie :: IE GhcRn
</span><a href="#local-6989586621681135645"><span class="hs-identifier hs-var hs-var">renamed_ie</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XIEThingAll GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass.
XIEThingAll pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-var">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAll GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135655"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; Name -&gt; IEWrappedName Name
forall name1 name2.
IEWrappedName name1 -&gt; name2 -&gt; IEWrappedName name2
</span><a href="GHC.Hs.ImpExp.html#replaceWrappedName"><span class="hs-identifier hs-var">replaceWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135654"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135653"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1033"></span><span>                </span><span id="local-6989586621681135644"><span class="annot"><span class="annottext">sub_avails :: [(IE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135644"><span class="hs-identifier hs-var hs-var">sub_avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135652"><span class="hs-identifier hs-var">avail</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1034"></span><span>                               </span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1035"></span><span>                               </span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135643"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135643"><span class="hs-identifier hs-var">name2</span></a></span></span><span> </span><span id="local-6989586621681135642"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135642"><span class="hs-identifier hs-var">subs</span></a></span></span><span> </span><span id="local-6989586621681135641"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135641"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135645"><span class="hs-identifier hs-var">renamed_ie</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135643"><span class="hs-identifier hs-var">name2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135642"><span class="hs-identifier hs-var">subs</span></a></span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; [Name] -&gt; [Name]
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#%5C%5C"><span class="hs-operator hs-var">\\</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135653"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135641"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1036"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="#local-6989586621681135651"><span class="hs-identifier hs-var">mb_parent</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1037"></span><span>              </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135645"><span class="hs-identifier hs-var">renamed_ie</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135652"><span class="hs-identifier hs-var">avail</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[IELookupWarning]
</span><a href="#local-6989586621681135650"><span class="hs-identifier hs-var">warns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1038"></span><span>                             </span><span class="hs-comment">-- non-associated ty/cls</span><span>
</span><span id="line-1039"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135640"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135640"><span class="hs-identifier hs-var">parent</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135645"><span class="hs-identifier hs-var">renamed_ie</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135640"><span class="hs-identifier hs-var">parent</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135653"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IE GhcRn, AvailInfo)
-&gt; [(IE GhcRn, AvailInfo)] -&gt; [(IE GhcRn, AvailInfo)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(IE GhcRn, AvailInfo)]
</span><a href="#local-6989586621681135644"><span class="hs-identifier hs-var">sub_avails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[IELookupWarning]
</span><a href="#local-6989586621681135650"><span class="hs-identifier hs-var">warns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1040"></span><span>                             </span><span class="hs-comment">-- associated type</span><span>
</span><span id="line-1041"></span><span>
</span><span id="line-1042"></span><span>        </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingAbs"><span class="hs-identifier hs-type">IEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingAbs GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135638"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135638"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135637"><span class="annot"><span class="annottext">IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135637"><span class="hs-identifier hs-var">tc'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1043"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135766"><span class="hs-identifier hs-var">want_hiding</span></a></span><span>   </span><span class="hs-comment">-- hiding ( C )</span><span>
</span><span id="line-1044"></span><span>                       </span><span class="hs-comment">-- Here the 'C' can be a data constructor</span><span>
</span><span id="line-1045"></span><span>                       </span><span class="hs-comment">--  *or* a type/class, or even both</span><span>
</span><span id="line-1046"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135636"><span class="annot"><span class="annottext">tc :: RdrName
</span><a href="#local-6989586621681135636"><span class="hs-identifier hs-var hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135637"><span class="hs-identifier hs-var">tc'</span></a></span><span>
</span><span id="line-1047"></span><span>                   </span><span id="local-6989586621681135635"><span class="annot"><span class="annottext">tc_name :: IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135635"><span class="hs-identifier hs-var hs-var">tc_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var">lookup_name</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135636"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1048"></span><span>                   </span><span id="local-6989586621681135634"><span class="annot"><span class="annottext">dc_name :: IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135634"><span class="hs-identifier hs-var hs-var">dc_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var">lookup_name</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; NameSpace -&gt; RdrName
</span><a href="GHC.Parser.PostProcess.html#setRdrNameSpace"><span class="hs-identifier hs-var">setRdrNameSpace</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135636"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">NameSpace
</span><a href="GHC.Types.Name.Occurrence.html#srcDataName"><span class="hs-identifier hs-var">srcDataName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1049"></span><span>               </span><span class="hs-keyword">in</span><span>
</span><span id="line-1050"></span><span>               </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[IELookupM (Name, AvailInfo, Maybe Name)]
-&gt; [(Name, AvailInfo, Maybe Name)]
forall a. [IELookupM a] -&gt; [a]
</span><a href="GHC.Rename.Names.html#catIELookupM"><span class="hs-identifier hs-var">catIELookupM</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135635"><span class="hs-identifier hs-var">tc_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135634"><span class="hs-identifier hs-var">dc_name</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1051"></span><span>                 </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IELookupError
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var">failLookupWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; IELookupError
</span><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-var">BadImport</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1052"></span><span>                 </span><span id="local-6989586621681135631"><span class="annot"><span class="annottext">[(Name, AvailInfo, Maybe Name)]
</span><a href="#local-6989586621681135631"><span class="hs-identifier hs-var">names</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">IEWrappedName RdrName
-&gt; SrcSpan
-&gt; (Name, AvailInfo, Maybe Name)
-&gt; (IE GhcRn, AvailInfo)
forall {pass} {name1}.
(XIEThingAbs pass ~ NoExtField, IdP pass ~ Name) =&gt;
IEWrappedName name1
-&gt; SrcSpan -&gt; (Name, AvailInfo, Maybe Name) -&gt; (IE pass, AvailInfo)
</span><a href="#local-6989586621681135630"><span class="hs-identifier hs-var">mkIEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135637"><span class="hs-identifier hs-var">tc'</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135638"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135629"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681135629"><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135629"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Name, AvailInfo, Maybe Name)]
</span><a href="#local-6989586621681135631"><span class="hs-identifier hs-var">names</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1053"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1054"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681135628"><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135628"><span class="hs-identifier hs-var">nameAvail</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; RdrName -&gt; IELookupM (Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135713"><span class="hs-identifier hs-var">lookup_name</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135667"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135637"><span class="hs-identifier hs-var">tc'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1055"></span><span>                  </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">IEWrappedName RdrName
-&gt; SrcSpan
-&gt; (Name, AvailInfo, Maybe Name)
-&gt; (IE GhcRn, AvailInfo)
forall {pass} {name1}.
(XIEThingAbs pass ~ NoExtField, IdP pass ~ Name) =&gt;
IEWrappedName name1
-&gt; SrcSpan -&gt; (Name, AvailInfo, Maybe Name) -&gt; (IE pass, AvailInfo)
</span><a href="#local-6989586621681135630"><span class="hs-identifier hs-var">mkIEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135637"><span class="hs-identifier hs-var">tc'</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135638"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, AvailInfo, Maybe Name)
</span><a href="#local-6989586621681135628"><span class="hs-identifier hs-var">nameAvail</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1056"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1057"></span><span>
</span><span id="line-1058"></span><span>        </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingWith"><span class="hs-identifier hs-type">IEThingWith</span></a></span><span> </span><span id="local-6989586621681135626"><span class="annot"><span class="annottext">XIEThingWith GhcPs
</span><a href="#local-6989586621681135626"><span class="hs-identifier hs-var">xt</span></a></span></span><span> </span><span id="local-6989586621681135625"><span class="annot"><span class="annottext">ltc :: GenLocated SrcSpan (IEWrappedName (IdP GhcPs))
</span><a href="#local-6989586621681135625"><span class="hs-identifier hs-var">ltc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135624"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135624"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135623"><span class="annot"><span class="annottext">IEWrappedName (IdP GhcPs)
</span><a href="#local-6989586621681135623"><span class="hs-identifier hs-var">rdr_tc</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681135622"><span class="annot"><span class="annottext">IEWildcard
</span><a href="#local-6989586621681135622"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621681135621"><span class="annot"><span class="annottext">[GenLocated SrcSpan (IEWrappedName (IdP GhcPs))]
</span><a href="#local-6989586621681135621"><span class="hs-identifier hs-var">rdr_ns</span></a></span></span><span> </span><span id="local-6989586621681135620"><span class="annot"><span class="annottext">[Located (FieldLbl (IdP GhcPs))]
</span><a href="#local-6989586621681135620"><span class="hs-identifier hs-var">rdr_fs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1059"></span><span>          </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">rdr_fs</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">rdr_fs</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1060"></span><span>           </span><span class="hs-special">(</span><span class="hs-identifier">name</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">avail</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mb_parent</span><span class="hs-special">)</span><span>
</span><span id="line-1061"></span><span>               </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">lookup_name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">IEThingAbs</span><span> </span><span class="hs-identifier">noExtField</span><span> </span><span class="hs-identifier">ltc</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ieWrappedName</span><span> </span><span class="hs-identifier">rdr_tc</span><span class="hs-special">)</span><span>
</span><span id="line-1062"></span><span>
</span><span id="line-1063"></span><span>           </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ns</span><span class="hs-special">,</span><span class="hs-identifier">subflds</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">avail</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1064"></span><span>                                </span><span class="hs-identifier">AvailTC</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">ns'</span><span> </span><span class="hs-identifier">subflds'</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ns'</span><span class="hs-special">,</span><span class="hs-identifier">subflds'</span><span class="hs-special">)</span><span>
</span><span id="line-1065"></span><span>                                </span><span class="hs-identifier">Avail</span><span> </span><span class="hs-identifier">_</span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">panic</span><span> </span><span class="hs-string">&quot;filterImports&quot;</span><span>
</span><span id="line-1066"></span><span>
</span><span id="line-1067"></span><span>           </span><span class="hs-comment">-- Look up the children in the sub-names of the parent</span><span>
</span><span id="line-1068"></span><span>           </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">subnames</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">ns</span><span> </span><span class="hs-keyword">of</span><span>   </span><span class="hs-comment">-- The tc is first in ns,</span><span>
</span><span id="line-1069"></span><span>                            </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- if it is there at all</span><span>
</span><span id="line-1070"></span><span>                                       </span><span class="hs-comment">-- See the AvailTC Invariant in</span><span>
</span><span id="line-1071"></span><span>                                       </span><span class="hs-comment">-- GHC.Types.Avail</span><span>
</span><span id="line-1072"></span><span>                            </span><span class="hs-special">(</span><span class="hs-identifier">n1</span><span class="hs-glyph">:</span><span class="hs-identifier">ns1</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">n1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ns1</span><span>
</span><span id="line-1073"></span><span>                                     </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ns</span><span>
</span><span id="line-1074"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">lookupChildren</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">Left</span><span> </span><span class="hs-identifier">subnames</span><span> </span><span class="hs-operator">++</span><span> </span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">Right</span><span> </span><span class="hs-identifier">subflds</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">rdr_ns</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1075"></span><span>
</span><span id="line-1076"></span><span>             </span><span class="hs-identifier">Failed</span><span> </span><span class="hs-identifier">rdrs</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">failLookupWith</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">BadImport</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">IEThingWith</span><span> </span><span class="hs-identifier">xt</span><span> </span><span class="hs-identifier">ltc</span><span> </span><span class="hs-identifier">wc</span><span> </span><span class="hs-identifier">rdrs</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1077"></span><span>                                </span><span class="hs-comment">-- We are trying to import T( a,b,c,d ), and failed</span><span>
</span><span id="line-1078"></span><span>                                </span><span class="hs-comment">-- to find 'b' and 'd'.  So we make up an import item</span><span>
</span><span id="line-1079"></span><span>                                </span><span class="hs-comment">-- to report as failing, namely T( b, d ).</span><span>
</span><span id="line-1080"></span><span>                                </span><span class="hs-comment">-- c.f. #15412</span><span>
</span><span id="line-1081"></span><span>
</span><span id="line-1082"></span><span>             </span><span class="hs-identifier">Succeeded</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">childnames</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">childflds</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1083"></span><span>               </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">mb_parent</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1084"></span><span>                 </span><span class="hs-comment">-- non-associated ty/cls</span><span>
</span><span id="line-1085"></span><span>                 </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-1086"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier">IEThingWith</span><span> </span><span class="hs-identifier">noExtField</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">L</span><span> </span><span class="hs-identifier">l</span><span> </span><span class="hs-identifier">name'</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">wc</span><span> </span><span class="hs-identifier">childnames'</span><span>
</span><span id="line-1087"></span><span>                                                                 </span><span class="hs-identifier">childflds</span><span class="hs-special">,</span><span>
</span><span id="line-1088"></span><span>                               </span><span class="hs-identifier">AvailTC</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">name</span><span class="hs-glyph">:</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">childnames</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">childflds</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1089"></span><span>                              </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1090"></span><span>                   </span><span class="hs-keyword">where</span><span> </span><span class="hs-identifier">name'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">replaceWrappedName</span><span> </span><span class="hs-identifier">rdr_tc</span><span> </span><span class="hs-identifier">name</span><span>
</span><span id="line-1091"></span><span>                         </span><span class="hs-identifier">childnames'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">to_ie_post_rn</span><span> </span><span class="hs-identifier">childnames</span><span>
</span><span id="line-1092"></span><span>                         </span><span class="hs-comment">-- childnames' = postrn_ies childnames</span><span>
</span><span id="line-1093"></span><span>                 </span><span class="hs-comment">-- associated ty</span><span>
</span><span id="line-1094"></span><span>                 </span><span class="hs-identifier">Just</span><span> </span><span class="hs-identifier">parent</span><span>
</span><span id="line-1095"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier">IEThingWith</span><span> </span><span class="hs-identifier">noExtField</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">L</span><span> </span><span class="hs-identifier">l</span><span> </span><span class="hs-identifier">name'</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">wc</span><span> </span><span class="hs-identifier">childnames'</span><span>
</span><span id="line-1096"></span><span>                                                           </span><span class="hs-identifier">childflds</span><span class="hs-special">,</span><span>
</span><span id="line-1097"></span><span>                                </span><span class="hs-identifier">AvailTC</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">childnames</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">childflds</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1098"></span><span>                               </span><span class="hs-special">(</span><span class="hs-identifier">IEThingWith</span><span> </span><span class="hs-identifier">noExtField</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">L</span><span> </span><span class="hs-identifier">l</span><span> </span><span class="hs-identifier">name'</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">wc</span><span> </span><span class="hs-identifier">childnames'</span><span>
</span><span id="line-1099"></span><span>                                                           </span><span class="hs-identifier">childflds</span><span class="hs-special">,</span><span>
</span><span id="line-1100"></span><span>                                </span><span class="hs-identifier">AvailTC</span><span> </span><span class="hs-identifier">parent</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">name</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1101"></span><span>                              </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1102"></span><span>                   </span><span class="hs-keyword">where</span><span> </span><span class="hs-identifier">name'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">replaceWrappedName</span><span> </span><span class="hs-identifier">rdr_tc</span><span> </span><span class="hs-identifier">name</span><span>
</span><span id="line-1103"></span><span>                         </span><span class="hs-identifier">childnames'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">to_ie_post_rn</span><span> </span><span class="hs-identifier">childnames</span><span>
</span><span id="line-1104"></span><span>
</span><span id="line-1105"></span><span>        </span><span id="local-6989586621681135598"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135598"><span class="hs-identifier hs-var">_other</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IELookupError
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var">failLookupWith</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="GHC.Rename.Names.html#IllegalImport"><span class="hs-identifier hs-var">IllegalImport</span></a></span><span>
</span><span id="line-1106"></span><span>        </span><span class="hs-comment">-- could be IEModuleContents, IEGroup, IEDoc, IEDocNamed</span><span>
</span><span id="line-1107"></span><span>        </span><span class="hs-comment">-- all errors.</span><span>
</span><span id="line-1108"></span><span>
</span><span id="line-1109"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1110"></span><span>        </span><span id="local-6989586621681135630"><span class="annot"><span class="annottext">mkIEThingAbs :: IEWrappedName name1
-&gt; SrcSpan -&gt; (Name, AvailInfo, Maybe Name) -&gt; (IE pass, AvailInfo)
</span><a href="#local-6989586621681135630"><span class="hs-identifier hs-var hs-var">mkIEThingAbs</span></a></span></span><span> </span><span id="local-6989586621681135589"><span class="annot"><span class="annottext">IEWrappedName name1
</span><a href="#local-6989586621681135589"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681135588"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135588"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135587"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135587"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135586"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135586"><span class="hs-identifier hs-var">av</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-1111"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEThingAbs pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
forall pass.
XIEThingAbs pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAbs"><span class="hs-identifier hs-var">IEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAbs pass
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135588"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IEWrappedName name1 -&gt; Name -&gt; IEWrappedName Name
forall name1 name2.
IEWrappedName name1 -&gt; name2 -&gt; IEWrappedName name2
</span><a href="GHC.Hs.ImpExp.html#replaceWrappedName"><span class="hs-identifier hs-var">replaceWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName name1
</span><a href="#local-6989586621681135589"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135587"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#trimAvail"><span class="hs-identifier hs-var">trimAvail</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135586"><span class="hs-identifier hs-var">av</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135587"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1112"></span><span>        </span><span class="annot"><a href="#local-6989586621681135630"><span class="hs-identifier hs-var">mkIEThingAbs</span></a></span><span> </span><span id="local-6989586621681135585"><span class="annot"><span class="annottext">IEWrappedName name1
</span><a href="#local-6989586621681135585"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681135584"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135584"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135583"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135583"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135582"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135582"><span class="hs-identifier hs-var">parent</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1113"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEThingAbs pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
forall pass.
XIEThingAbs pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAbs"><span class="hs-identifier hs-var">IEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAbs pass
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135584"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IEWrappedName name1 -&gt; Name -&gt; IEWrappedName Name
forall name1 name2.
IEWrappedName name1 -&gt; name2 -&gt; IEWrappedName name2
</span><a href="GHC.Hs.ImpExp.html#replaceWrappedName"><span class="hs-identifier hs-var">replaceWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName name1
</span><a href="#local-6989586621681135585"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135583"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1114"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135582"><span class="hs-identifier hs-var">parent</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135583"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1115"></span><span>
</span><span id="line-1116"></span><span>        </span><span id="local-6989586621681135666"><span class="annot"><span class="annottext">handle_bad_import :: IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135666"><span class="hs-identifier hs-var hs-var">handle_bad_import</span></a></span></span><span> </span><span id="local-6989586621681135581"><span class="annot"><span class="annottext">IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135581"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; (IELookupError
    -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a.
IELookupM a -&gt; (IELookupError -&gt; IELookupM a) -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#catchIELookup"><span class="hs-identifier hs-var">catchIELookup</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
</span><a href="#local-6989586621681135581"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">((IELookupError
  -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
 -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; (IELookupError
    -&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning]))
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681135579"><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135579"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135579"><span class="hs-identifier hs-var">err</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1117"></span><span>          </span><span class="annot"><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-type">BadImport</span></a></span><span> </span><span id="local-6989586621681135578"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135578"><span class="hs-identifier hs-var">ie</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135766"><span class="hs-identifier hs-var">want_hiding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([(IE GhcRn, AvailInfo)], [IELookupWarning])
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">IE GhcPs -&gt; IELookupWarning
</span><a href="GHC.Rename.Names.html#BadImportW"><span class="hs-identifier hs-var">BadImportW</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135578"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1118"></span><span>          </span><span class="annot"><span class="annottext">IELookupError
</span><span class="hs-identifier">_</span></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IELookupError
-&gt; IELookupM ([(IE GhcRn, AvailInfo)], [IELookupWarning])
forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var">failLookupWith</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135579"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1119"></span><span>
</span><span id="line-1120"></span><span class="hs-keyword">type</span><span> </span><span id="IELookupM"><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-var">IELookupM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#MaybeErr"><span class="hs-identifier hs-type">MaybeErr</span></a></span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupError"><span class="hs-identifier hs-type">IELookupError</span></a></span><span>
</span><span id="line-1121"></span><span>
</span><span id="line-1122"></span><span class="hs-keyword">data</span><span> </span><span id="IELookupWarning"><span class="annot"><a href="GHC.Rename.Names.html#IELookupWarning"><span class="hs-identifier hs-var">IELookupWarning</span></a></span></span><span>
</span><span id="line-1123"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="BadImportW"><span class="annot"><a href="GHC.Rename.Names.html#BadImportW"><span class="hs-identifier hs-var">BadImportW</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1124"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="MissingImportList"><span class="annot"><a href="GHC.Rename.Names.html#MissingImportList"><span class="hs-identifier hs-var">MissingImportList</span></a></span></span><span>
</span><span id="line-1125"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="DodgyImport"><span class="annot"><a href="GHC.Rename.Names.html#DodgyImport"><span class="hs-identifier hs-var">DodgyImport</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-1126"></span><span>  </span><span class="hs-comment">-- NB. use the RdrName for reporting a &quot;dodgy&quot; import</span><span>
</span><span id="line-1127"></span><span>
</span><span id="line-1128"></span><span class="hs-keyword">data</span><span> </span><span id="IELookupError"><span class="annot"><a href="GHC.Rename.Names.html#IELookupError"><span class="hs-identifier hs-var">IELookupError</span></a></span></span><span>
</span><span id="line-1129"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="QualImportError"><span class="annot"><a href="GHC.Rename.Names.html#QualImportError"><span class="hs-identifier hs-var">QualImportError</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-1130"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BadImport"><span class="annot"><a href="GHC.Rename.Names.html#BadImport"><span class="hs-identifier hs-var">BadImport</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1131"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="IllegalImport"><span class="annot"><a href="GHC.Rename.Names.html#IllegalImport"><span class="hs-identifier hs-var">IllegalImport</span></a></span></span><span>
</span><span id="line-1132"></span><span>
</span><span id="line-1133"></span><span id="local-6989586621681136788"><span class="annot"><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-type">failLookupWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupError"><span class="hs-identifier hs-type">IELookupError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136788"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1134"></span><span id="failLookupWith"><span class="annot"><span class="annottext">failLookupWith :: forall a. IELookupError -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#failLookupWith"><span class="hs-identifier hs-var hs-var">failLookupWith</span></a></span></span><span> </span><span id="local-6989586621681135577"><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135577"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IELookupError -&gt; MaybeErr IELookupError a
forall err val. err -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-var">Failed</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135577"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1135"></span><span>
</span><span id="line-1136"></span><span id="local-6989586621681136753"><span class="annot"><a href="GHC.Rename.Names.html#catchIELookup"><span class="hs-identifier hs-type">catchIELookup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136753"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Rename.Names.html#IELookupError"><span class="hs-identifier hs-type">IELookupError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136753"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136753"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1137"></span><span id="catchIELookup"><span class="annot"><span class="annottext">catchIELookup :: forall a.
IELookupM a -&gt; (IELookupError -&gt; IELookupM a) -&gt; IELookupM a
</span><a href="GHC.Rename.Names.html#catchIELookup"><span class="hs-identifier hs-var hs-var">catchIELookup</span></a></span></span><span> </span><span id="local-6989586621681135575"><span class="annot"><span class="annottext">IELookupM a
</span><a href="#local-6989586621681135575"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621681135574"><span class="annot"><span class="annottext">IELookupError -&gt; IELookupM a
</span><a href="#local-6989586621681135574"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IELookupM a
</span><a href="#local-6989586621681135575"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1138"></span><span>  </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span id="local-6989586621681135573"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135573"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; IELookupM a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135573"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1139"></span><span>  </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Failed</span></a></span><span> </span><span id="local-6989586621681135572"><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135572"><span class="hs-identifier hs-var">err</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IELookupError -&gt; IELookupM a
</span><a href="#local-6989586621681135574"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">IELookupError
</span><a href="#local-6989586621681135572"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1140"></span><span>
</span><span id="line-1141"></span><span id="local-6989586621681136762"><span class="annot"><a href="GHC.Rename.Names.html#catIELookupM"><span class="hs-identifier hs-type">catIELookupM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#IELookupM"><span class="hs-identifier hs-type">IELookupM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136762"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681136762"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1142"></span><span id="catIELookupM"><span class="annot"><span class="annottext">catIELookupM :: forall a. [IELookupM a] -&gt; [a]
</span><a href="GHC.Rename.Names.html#catIELookupM"><span class="hs-identifier hs-var hs-var">catIELookupM</span></a></span></span><span> </span><span id="local-6989586621681135571"><span class="annot"><span class="annottext">[IELookupM a]
</span><a href="#local-6989586621681135571"><span class="hs-identifier hs-var">ms</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135570"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span id="local-6989586621681135570"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135570"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[IELookupM a]
</span><a href="#local-6989586621681135571"><span class="hs-identifier hs-var">ms</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1143"></span><span>
</span><span id="line-1144"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Import/Export Utils}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1151"></span><span>
</span><span id="line-1152"></span><span class="hs-comment">-- | Given an import\/export spec, construct the appropriate 'GlobalRdrElt's.</span><span>
</span><span id="line-1153"></span><span class="annot"><a href="GHC.Rename.Names.html#gresFromIE"><span class="hs-identifier hs-type">gresFromIE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1154"></span><span id="gresFromIE"><span class="annot"><span class="annottext">gresFromIE :: ImpDeclSpec -&gt; (LIE GhcRn, AvailInfo) -&gt; [GlobalRdrElt]
</span><a href="GHC.Rename.Names.html#gresFromIE"><span class="hs-identifier hs-var hs-var">gresFromIE</span></a></span></span><span> </span><span id="local-6989586621681135569"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135569"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135568"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135568"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681135567"><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135567"><span class="hs-identifier hs-var">ie</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135566"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135566"><span class="hs-identifier hs-var">avail</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1155"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Maybe ImportSpec) -&gt; AvailInfo -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvail"><span class="hs-identifier hs-var">gresFromAvail</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe ImportSpec
</span><a href="#local-6989586621681135564"><span class="hs-identifier hs-var">prov_fn</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135566"><span class="hs-identifier hs-var">avail</span></a></span><span>
</span><span id="line-1156"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1157"></span><span>    </span><span id="local-6989586621681135563"><span class="annot"><span class="annottext">is_explicit :: Name -&gt; Bool
</span><a href="#local-6989586621681135563"><span class="hs-identifier hs-var hs-var">is_explicit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135567"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1158"></span><span>                    </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-type">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingAll GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135562"><span class="annot"><span class="annottext">LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135562"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681135561"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135561"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135561"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name)
LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135562"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1159"></span><span>                    </span><span class="annot"><span class="annottext">IE GhcRn
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1160"></span><span>    </span><span id="local-6989586621681135564"><span class="annot"><span class="annottext">prov_fn :: Name -&gt; Maybe ImportSpec
</span><a href="#local-6989586621681135564"><span class="hs-identifier hs-var hs-var">prov_fn</span></a></span></span><span> </span><span id="local-6989586621681135559"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135559"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1161"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportSpec -&gt; Maybe ImportSpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpSpec :: ImpDeclSpec -&gt; ImpItemSpec -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSpec"><span class="hs-identifier hs-type">ImpSpec</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_decl :: ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#is_decl"><span class="hs-identifier hs-var">is_decl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135569"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_item :: ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#is_item"><span class="hs-identifier hs-var">is_item</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpItemSpec
</span><a href="#local-6989586621681135558"><span class="hs-identifier hs-var">item_spec</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1162"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1163"></span><span>        </span><span id="local-6989586621681135558"><span class="annot"><span class="annottext">item_spec :: ImpItemSpec
</span><a href="#local-6989586621681135558"><span class="hs-identifier hs-var hs-var">item_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpSome :: Bool -&gt; SrcSpan -&gt; ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSome"><span class="hs-identifier hs-type">ImpSome</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_explicit :: Bool
</span><a href="GHC.Types.Name.Reader.html#is_explicit"><span class="hs-identifier hs-var">is_explicit</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681135563"><span class="hs-identifier hs-var">is_explicit</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135559"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_iloc :: SrcSpan
</span><a href="GHC.Types.Name.Reader.html#is_iloc"><span class="hs-identifier hs-var">is_iloc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135568"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1164"></span><span>
</span><span id="line-1165"></span><span>
</span><span id="line-1166"></span><span class="hs-comment">{-
Note [Children for duplicate record fields]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the module

    {-# LANGUAGE DuplicateRecordFields #-}
    module M (F(foo, MkFInt, MkFBool)) where
      data family F a
      data instance F Int = MkFInt { foo :: Int }
      data instance F Bool = MkFBool { foo :: Bool }

The `foo` in the export list refers to *both* selectors! For this
reason, lookupChildren builds an environment that maps the FastString
to a list of items, rather than a single item.
-}</span><span>
</span><span id="line-1181"></span><span>
</span><span id="line-1182"></span><span class="annot"><a href="GHC.Rename.Names.html#mkChildEnv"><span class="hs-identifier hs-type">mkChildEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1183"></span><span id="mkChildEnv"><span class="annot"><span class="annottext">mkChildEnv :: [GlobalRdrElt] -&gt; NameEnv [GlobalRdrElt]
</span><a href="GHC.Rename.Names.html#mkChildEnv"><span class="hs-identifier hs-var hs-var">mkChildEnv</span></a></span></span><span> </span><span id="local-6989586621681135554"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135554"><span class="hs-identifier hs-var">gres</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; NameEnv [GlobalRdrElt] -&gt; NameEnv [GlobalRdrElt])
-&gt; NameEnv [GlobalRdrElt]
-&gt; [GlobalRdrElt]
-&gt; NameEnv [GlobalRdrElt]
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; NameEnv [GlobalRdrElt] -&gt; NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135553"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135554"><span class="hs-identifier hs-var">gres</span></a></span><span>
</span><span id="line-1184"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1185"></span><span>    </span><span id="local-6989586621681135553"><span class="annot"><span class="annottext">add :: GlobalRdrElt -&gt; NameEnv [GlobalRdrElt] -&gt; NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135553"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621681135551"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135551"><span class="hs-identifier hs-var">gre</span></a></span></span><span> </span><span id="local-6989586621681135550"><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135550"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Parent
</span><a href="GHC.Types.Name.Reader.html#gre_par"><span class="hs-identifier hs-var hs-var">gre_par</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135551"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1186"></span><span>        </span><span class="annot"><a href="GHC.Types.Name.Reader.html#FldParent"><span class="hs-identifier hs-type">FldParent</span></a></span><span> </span><span id="local-6989586621681135547"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135547"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe FastString
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt])
-&gt; (GlobalRdrElt -&gt; [GlobalRdrElt])
-&gt; NameEnv [GlobalRdrElt]
-&gt; Name
-&gt; GlobalRdrElt
-&gt; NameEnv [GlobalRdrElt]
forall a b.
(a -&gt; b -&gt; b) -&gt; (a -&gt; b) -&gt; NameEnv b -&gt; Name -&gt; a -&gt; NameEnv b
</span><a href="GHC.Types.Name.Env.html#extendNameEnv_Acc"><span class="hs-identifier hs-var">extendNameEnv_Acc</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; [GlobalRdrElt]
forall a. a -&gt; [a]
</span><a href="GHC.Utils.Misc.html#singleton"><span class="hs-identifier hs-var">Utils.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135550"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135547"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135551"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-1187"></span><span>        </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ParentIs"><span class="hs-identifier hs-type">ParentIs</span></a></span><span>  </span><span id="local-6989586621681135543"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135543"><span class="hs-identifier hs-var">p</span></a></span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt])
-&gt; (GlobalRdrElt -&gt; [GlobalRdrElt])
-&gt; NameEnv [GlobalRdrElt]
-&gt; Name
-&gt; GlobalRdrElt
-&gt; NameEnv [GlobalRdrElt]
forall a b.
(a -&gt; b -&gt; b) -&gt; (a -&gt; b) -&gt; NameEnv b -&gt; Name -&gt; a -&gt; NameEnv b
</span><a href="GHC.Types.Name.Env.html#extendNameEnv_Acc"><span class="hs-identifier hs-var">extendNameEnv_Acc</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; [GlobalRdrElt]
forall a. a -&gt; [a]
</span><a href="GHC.Utils.Misc.html#singleton"><span class="hs-identifier hs-var">Utils.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135550"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135543"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135551"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-1188"></span><span>        </span><span class="annot"><span class="annottext">Parent
</span><a href="GHC.Types.Name.Reader.html#NoParent"><span class="hs-identifier hs-var">NoParent</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135550"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1189"></span><span>
</span><span id="line-1190"></span><span id="local-6989586621681136741"><span class="annot"><a href="GHC.Rename.Names.html#findChildren"><span class="hs-identifier hs-type">findChildren</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681136741"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681136741"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1191"></span><span id="findChildren"><span class="annot"><span class="annottext">findChildren :: forall a. NameEnv [a] -&gt; Name -&gt; [a]
</span><a href="GHC.Rename.Names.html#findChildren"><span class="hs-identifier hs-var hs-var">findChildren</span></a></span></span><span> </span><span id="local-6989586621681135541"><span class="annot"><span class="annottext">NameEnv [a]
</span><a href="#local-6989586621681135541"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621681135540"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135540"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv [a] -&gt; Name -&gt; Maybe [a]
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [a]
</span><a href="#local-6989586621681135541"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135540"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [a] -&gt; [a] -&gt; [a]
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1192"></span><span>
</span><span id="line-1193"></span><span class="annot"><a href="GHC.Rename.Names.html#lookupChildren"><span class="hs-identifier hs-type">lookupChildren</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIEWrappedName"><span class="hs-identifier hs-type">LIEWrappedName</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1194"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#MaybeErr"><span class="hs-identifier hs-type">MaybeErr</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIEWrappedName"><span class="hs-identifier hs-type">LIEWrappedName</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- The ones for which the lookup failed</span><span>
</span><span id="line-1195"></span><span>                           </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1196"></span><span class="hs-comment">-- (lookupChildren all_kids rdr_items) maps each rdr_item to its</span><span>
</span><span id="line-1197"></span><span class="hs-comment">-- corresponding Name all_kids, if the former exists</span><span>
</span><span id="line-1198"></span><span class="hs-comment">-- The matching is done by FastString, not OccName, so that</span><span>
</span><span id="line-1199"></span><span class="hs-comment">--    Cls( meth, AssocTy )</span><span>
</span><span id="line-1200"></span><span class="hs-comment">-- will correctly find AssocTy among the all_kids of Cls, even though</span><span>
</span><span id="line-1201"></span><span class="hs-comment">-- the RdrName for AssocTy may have a (bogus) DataName namespace</span><span>
</span><span id="line-1202"></span><span class="hs-comment">-- (Really the rdr_items should be FastStrings in the first place.)</span><span>
</span><span id="line-1203"></span><span id="lookupChildren"><span class="annot"><span class="annottext">lookupChildren :: [Either Name FieldLabel]
-&gt; [LIEWrappedName RdrName]
-&gt; MaybeErr
     [LIEWrappedName RdrName] ([Located Name], [Located FieldLabel])
</span><a href="GHC.Rename.Names.html#lookupChildren"><span class="hs-identifier hs-var hs-var">lookupChildren</span></a></span></span><span> </span><span id="local-6989586621681135538"><span class="annot"><span class="annottext">[Either Name FieldLabel]
</span><a href="#local-6989586621681135538"><span class="hs-identifier hs-var">all_kids</span></a></span></span><span> </span><span id="local-6989586621681135537"><span class="annot"><span class="annottext">[LIEWrappedName RdrName]
</span><a href="#local-6989586621681135537"><span class="hs-identifier hs-var">rdr_items</span></a></span></span><span>
</span><span id="line-1204"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[LIEWrappedName RdrName] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LIEWrappedName RdrName]
</span><a href="#local-6989586621681135536"><span class="hs-identifier hs-var">fails</span></a></span><span>
</span><span id="line-1205"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Located Name], [Located FieldLabel])
-&gt; MaybeErr
     [LIEWrappedName RdrName] ([Located Name], [Located FieldLabel])
forall err val. val -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([[Located FieldLabel]] -&gt; [Located FieldLabel])
-&gt; ([Located Name], [[Located FieldLabel]])
-&gt; ([Located Name], [Located FieldLabel])
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">[[Located FieldLabel]] -&gt; [Located FieldLabel]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Either (Located Name) [Located FieldLabel]]
-&gt; ([Located Name], [[Located FieldLabel]])
forall a b. [Either a b] -&gt; ([a], [b])
</span><a href="../../base/src/Data.Either.html#partitionEithers"><span class="hs-identifier hs-var">partitionEithers</span></a></span><span> </span><span class="annot"><span class="annottext">[Either (Located Name) [Located FieldLabel]]
</span><a href="#local-6989586621681135535"><span class="hs-identifier hs-var">oks</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span>       </span><span class="hs-comment">-- This 'fmap concat' trickily applies concat to the /second/ component</span><span>
</span><span id="line-1207"></span><span>       </span><span class="hs-comment">-- of the pair, whose type is ([Located Name], [[Located FieldLabel]])</span><span>
</span><span id="line-1208"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1209"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LIEWrappedName RdrName]
-&gt; MaybeErr
     [LIEWrappedName RdrName] ([Located Name], [Located FieldLabel])
forall err val. err -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-var">Failed</span></a></span><span> </span><span class="annot"><span class="annottext">[LIEWrappedName RdrName]
</span><a href="#local-6989586621681135536"><span class="hs-identifier hs-var">fails</span></a></span><span>
</span><span id="line-1210"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1211"></span><span>    </span><span id="local-6989586621681135534"><span class="annot"><span class="annottext">mb_xs :: [MaybeErr
   (LIEWrappedName RdrName)
   (Either (Located Name) [Located FieldLabel])]
</span><a href="#local-6989586621681135534"><span class="hs-identifier hs-var hs-var">mb_xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LIEWrappedName RdrName
 -&gt; MaybeErr
      (LIEWrappedName RdrName)
      (Either (Located Name) [Located FieldLabel]))
-&gt; [LIEWrappedName RdrName]
-&gt; [MaybeErr
      (LIEWrappedName RdrName)
      (Either (Located Name) [Located FieldLabel])]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LIEWrappedName RdrName
-&gt; MaybeErr
     (LIEWrappedName RdrName)
     (Either (Located Name) [Located FieldLabel])
</span><a href="#local-6989586621681135533"><span class="hs-identifier hs-var">doOne</span></a></span><span> </span><span class="annot"><span class="annottext">[LIEWrappedName RdrName]
</span><a href="#local-6989586621681135537"><span class="hs-identifier hs-var">rdr_items</span></a></span><span>
</span><span id="line-1212"></span><span>    </span><span id="local-6989586621681135536"><span class="annot"><span class="annottext">fails :: [LIEWrappedName RdrName]
</span><a href="#local-6989586621681135536"><span class="hs-identifier hs-var hs-var">fails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">LIEWrappedName RdrName
</span><a href="#local-6989586621681135532"><span class="hs-identifier hs-var">bad_rdr</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Failed</span></a></span><span> </span><span id="local-6989586621681135532"><span class="annot"><span class="annottext">LIEWrappedName RdrName
</span><a href="#local-6989586621681135532"><span class="hs-identifier hs-var">bad_rdr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MaybeErr
   (LIEWrappedName RdrName)
   (Either (Located Name) [Located FieldLabel])]
</span><a href="#local-6989586621681135534"><span class="hs-identifier hs-var">mb_xs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1213"></span><span>    </span><span id="local-6989586621681135535"><span class="annot"><span class="annottext">oks :: [Either (Located Name) [Located FieldLabel]]
</span><a href="#local-6989586621681135535"><span class="hs-identifier hs-var hs-var">oks</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Either (Located Name) [Located FieldLabel]
</span><a href="#local-6989586621681135531"><span class="hs-identifier hs-var">ok</span></a></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span id="local-6989586621681135531"><span class="annot"><span class="annottext">Either (Located Name) [Located FieldLabel]
</span><a href="#local-6989586621681135531"><span class="hs-identifier hs-var">ok</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MaybeErr
   (LIEWrappedName RdrName)
   (Either (Located Name) [Located FieldLabel])]
</span><a href="#local-6989586621681135534"><span class="hs-identifier hs-var">mb_xs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1214"></span><span>    </span><span class="annot"><a href="#local-6989586621681135535"><span class="hs-identifier hs-type">oks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-1215"></span><span>
</span><span id="line-1216"></span><span>    </span><span id="local-6989586621681135533"><span class="annot"><span class="annottext">doOne :: LIEWrappedName RdrName
-&gt; MaybeErr
     (LIEWrappedName RdrName)
     (Either (Located Name) [Located FieldLabel])
</span><a href="#local-6989586621681135533"><span class="hs-identifier hs-var hs-var">doOne</span></a></span></span><span> </span><span id="local-6989586621681135530"><span class="annot"><span class="annottext">item :: LIEWrappedName RdrName
</span><a href="#local-6989586621681135530"><span class="hs-identifier hs-var">item</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135529"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135529"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135528"><span class="annot"><span class="annottext">IEWrappedName RdrName
</span><a href="#local-6989586621681135528"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1217"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastStringEnv [Either Name FieldLabel]
-&gt; FastString -&gt; Maybe [Either Name FieldLabel]
forall a. FastStringEnv a -&gt; FastString -&gt; Maybe a
</span><a href="GHC.Data.FastString.Env.html#lookupFsEnv"><span class="hs-identifier hs-var">lookupFsEnv</span></a></span><span> </span><span class="annot"><span class="annottext">FastStringEnv [Either Name FieldLabel]
</span><a href="#local-6989586621681135527"><span class="hs-identifier hs-var">kid_env</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Maybe [Either Name FieldLabel])
-&gt; (IEWrappedName RdrName -&gt; FastString)
-&gt; IEWrappedName RdrName
-&gt; Maybe [Either Name FieldLabel]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString)
-&gt; (IEWrappedName RdrName -&gt; OccName)
-&gt; IEWrappedName RdrName
-&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; OccName)
-&gt; (IEWrappedName RdrName -&gt; RdrName)
-&gt; IEWrappedName RdrName
-&gt; OccName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName -&gt; RdrName
forall name. IEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#ieWrappedName"><span class="hs-identifier hs-var">ieWrappedName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IEWrappedName RdrName
</span><a href="#local-6989586621681135528"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1218"></span><span>           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621681135526"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135526"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">]</span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either (Located Name) [Located FieldLabel]
-&gt; MaybeErr
     (LIEWrappedName RdrName)
     (Either (Located Name) [Located FieldLabel])
forall err val. val -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; Either (Located Name) [Located FieldLabel]
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Name -&gt; Located Name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135529"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135526"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1219"></span><span>           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135525"><span class="annot"><span class="annottext">[Either Name FieldLabel]
</span><a href="#local-6989586621681135525"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Either Name FieldLabel -&gt; Bool)
-&gt; [Either Name FieldLabel] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Either Name FieldLabel -&gt; Bool
forall a b. Either a b -&gt; Bool
</span><a href="../../base/src/Data.Either.html#isRight"><span class="hs-identifier hs-var">isRight</span></a></span><span> </span><span class="annot"><span class="annottext">[Either Name FieldLabel]
</span><a href="#local-6989586621681135525"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either (Located Name) [Located FieldLabel]
-&gt; MaybeErr
     (LIEWrappedName RdrName)
     (Either (Located Name) [Located FieldLabel])
forall err val. val -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Located FieldLabel] -&gt; Either (Located Name) [Located FieldLabel]
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(FieldLabel -&gt; Located FieldLabel)
-&gt; [FieldLabel] -&gt; [Located FieldLabel]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; FieldLabel -&gt; Located FieldLabel
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135529"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Either Name FieldLabel] -&gt; [FieldLabel]
forall a b. [Either a b] -&gt; [b]
</span><a href="../../base/src/Data.Either.html#rights"><span class="hs-identifier hs-var">rights</span></a></span><span> </span><span class="annot"><span class="annottext">[Either Name FieldLabel]
</span><a href="#local-6989586621681135525"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1220"></span><span>           </span><span class="annot"><span class="annottext">Maybe [Either Name FieldLabel]
</span><span class="hs-identifier">_</span></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LIEWrappedName RdrName
-&gt; MaybeErr
     (LIEWrappedName RdrName)
     (Either (Located Name) [Located FieldLabel])
forall err val. err -&gt; MaybeErr err val
</span><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-var">Failed</span></a></span><span>    </span><span class="annot"><span class="annottext">LIEWrappedName RdrName
</span><a href="#local-6989586621681135530"><span class="hs-identifier hs-var">item</span></a></span><span>
</span><span id="line-1221"></span><span>
</span><span id="line-1222"></span><span>    </span><span class="hs-comment">-- See Note [Children for duplicate record fields]</span><span>
</span><span id="line-1223"></span><span>    </span><span id="local-6989586621681135527"><span class="annot"><span class="annottext">kid_env :: FastStringEnv [Either Name FieldLabel]
</span><a href="#local-6989586621681135527"><span class="hs-identifier hs-var hs-var">kid_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Either Name FieldLabel]
 -&gt; [Either Name FieldLabel] -&gt; [Either Name FieldLabel])
-&gt; FastStringEnv [Either Name FieldLabel]
-&gt; [(FastString, [Either Name FieldLabel])]
-&gt; FastStringEnv [Either Name FieldLabel]
forall a.
(a -&gt; a -&gt; a)
-&gt; FastStringEnv a -&gt; [(FastString, a)] -&gt; FastStringEnv a
</span><a href="GHC.Data.FastString.Env.html#extendFsEnvList_C"><span class="hs-identifier hs-var">extendFsEnvList_C</span></a></span><span> </span><span class="annot"><span class="annottext">[Either Name FieldLabel]
-&gt; [Either Name FieldLabel] -&gt; [Either Name FieldLabel]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">(++)</span></a></span><span> </span><span class="annot"><span class="annottext">FastStringEnv [Either Name FieldLabel]
forall a. FastStringEnv a
</span><a href="GHC.Data.FastString.Env.html#emptyFsEnv"><span class="hs-identifier hs-var">emptyFsEnv</span></a></span><span>
</span><span id="line-1224"></span><span>              </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; FastString)
-&gt; (FieldLabel -&gt; FastString)
-&gt; Either Name FieldLabel
-&gt; FastString
forall a c b. (a -&gt; c) -&gt; (b -&gt; c) -&gt; Either a b -&gt; c
</span><a href="../../base/src/Data.Either.html#either"><span class="hs-identifier hs-var">either</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString) -&gt; (Name -&gt; OccName) -&gt; Name -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; FastString
forall a. FieldLbl a -&gt; FastString
</span><a href="GHC.Types.FieldLabel.html#flLabel"><span class="hs-identifier hs-var hs-var">flLabel</span></a></span><span> </span><span class="annot"><span class="annottext">Either Name FieldLabel
</span><a href="#local-6989586621681135520"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Either Name FieldLabel
</span><a href="#local-6989586621681135520"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681135520"><span class="annot"><span class="annottext">Either Name FieldLabel
</span><a href="#local-6989586621681135520"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Either Name FieldLabel]
</span><a href="#local-6989586621681135538"><span class="hs-identifier hs-var">all_kids</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1225"></span><span>
</span><span id="line-1226"></span><span>
</span><span id="line-1227"></span><span>
</span><span id="line-1228"></span><span class="hs-comment">-------------------------------</span><span>
</span><span id="line-1229"></span><span>
</span><span id="line-1230"></span><span class="hs-comment">{-
*********************************************************
*                                                       *
\subsection{Unused names}
*                                                       *
*********************************************************
-}</span><span>
</span><span id="line-1237"></span><span>
</span><span id="line-1238"></span><span class="annot"><a href="GHC.Rename.Names.html#reportUnusedNames"><span class="hs-identifier hs-type">reportUnusedNames</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1239"></span><span id="reportUnusedNames"><span class="annot"><span class="annottext">reportUnusedNames :: TcGblEnv -&gt; HscSource -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#reportUnusedNames"><span class="hs-identifier hs-var hs-var">reportUnusedNames</span></a></span></span><span> </span><span id="local-6989586621681135519"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span> </span><span id="local-6989586621681135518"><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135518"><span class="hs-identifier hs-var">hsc_src</span></a></span></span><span>
</span><span id="line-1240"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135517"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135517"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRef Defs -&gt; TcRnIf TcGblEnv TcLclEnv Defs
forall a gbl lcl. TcRef a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#readTcRef"><span class="hs-identifier hs-var">readTcRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef Defs
</span><a href="GHC.Tc.Types.html#tcg_keep"><span class="hs-identifier hs-var hs-var">tcg_keep</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1241"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;RUN&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DefUses -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; DefUses
</span><a href="GHC.Tc.Types.html#tcg_dus"><span class="hs-identifier hs-var hs-var">tcg_dus</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1242"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; HscSource -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnUnusedImportDecls"><span class="hs-identifier hs-var">warnUnusedImportDecls</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135518"><span class="hs-identifier hs-var">hsc_src</span></a></span><span>
</span><span id="line-1243"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Utils.html#warnUnusedTopBinds"><span class="hs-identifier hs-var">warnUnusedTopBinds</span></a></span><span> </span><span class="annot"><span class="annottext">([GlobalRdrElt] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; [GlobalRdrElt] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Defs -&gt; [GlobalRdrElt]
</span><a href="#local-6989586621681135512"><span class="hs-identifier hs-var">unused_locals</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135517"><span class="hs-identifier hs-var">keep</span></a></span><span>
</span><span id="line-1244"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnMissingSignatures"><span class="hs-identifier hs-var">warnMissingSignatures</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1245"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1246"></span><span>    </span><span class="annot"><a href="#local-6989586621681135510"><span class="hs-identifier hs-type">used_names</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span>
</span><span id="line-1247"></span><span>    </span><span id="local-6989586621681135510"><span class="annot"><span class="annottext">used_names :: Defs -&gt; Defs
</span><a href="#local-6989586621681135510"><span class="hs-identifier hs-var hs-var">used_names</span></a></span></span><span> </span><span id="local-6989586621681135509"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135509"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DefUses -&gt; Defs -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#findUses"><span class="hs-identifier hs-var">findUses</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; DefUses
</span><a href="GHC.Tc.Types.html#tcg_dus"><span class="hs-identifier hs-var hs-var">tcg_dus</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span> </span><span class="annot"><span class="annottext">Defs -&gt; Defs -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#unionNameSet"><span class="hs-operator hs-var">`unionNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135509"><span class="hs-identifier hs-var">keep</span></a></span><span>
</span><span id="line-1248"></span><span>    </span><span class="hs-comment">-- NB: currently, if f x = g, we only treat 'g' as used if 'f' is used</span><span>
</span><span id="line-1249"></span><span>    </span><span class="hs-comment">-- Hence findUses</span><span>
</span><span id="line-1250"></span><span>
</span><span id="line-1251"></span><span>    </span><span class="hs-comment">-- Collect the defined names from the in-scope environment</span><span>
</span><span id="line-1252"></span><span>    </span><span class="annot"><a href="#local-6989586621681135506"><span class="hs-identifier hs-type">defined_names</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1253"></span><span>    </span><span id="local-6989586621681135506"><span class="annot"><span class="annottext">defined_names :: [GlobalRdrElt]
</span><a href="#local-6989586621681135506"><span class="hs-identifier hs-var hs-var">defined_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#globalRdrEnvElts"><span class="hs-identifier hs-var">globalRdrEnvElts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135519"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1254"></span><span>
</span><span id="line-1255"></span><span>    </span><span id="local-6989586621681135504"><span class="annot"><span class="annottext">kids_env :: NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135504"><span class="hs-identifier hs-var hs-var">kids_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; NameEnv [GlobalRdrElt]
</span><a href="GHC.Rename.Names.html#mkChildEnv"><span class="hs-identifier hs-var">mkChildEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135506"><span class="hs-identifier hs-var">defined_names</span></a></span><span>
</span><span id="line-1256"></span><span>    </span><span class="hs-comment">-- This is done in mkExports too; duplicated work</span><span>
</span><span id="line-1257"></span><span>
</span><span id="line-1258"></span><span>    </span><span class="annot"><a href="#local-6989586621681135503"><span class="hs-identifier hs-type">gre_is_used</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1259"></span><span>    </span><span id="local-6989586621681135503"><span class="annot"><span class="annottext">gre_is_used :: Defs -&gt; GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135503"><span class="hs-identifier hs-var hs-var">gre_is_used</span></a></span></span><span> </span><span id="local-6989586621681135502"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135502"><span class="hs-identifier hs-var">used_names</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GRE"><span class="hs-identifier hs-type">GRE</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">gre_name :: GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var">gre_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135500"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135500"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1260"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135500"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135502"><span class="hs-identifier hs-var">used_names</span></a></span><span>
</span><span id="line-1261"></span><span>          </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Bool) -&gt; [GlobalRdrElt] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681135498"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135498"><span class="hs-identifier hs-var">gre</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135498"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135502"><span class="hs-identifier hs-var">used_names</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt] -&gt; Name -&gt; [GlobalRdrElt]
forall a. NameEnv [a] -&gt; Name -&gt; [a]
</span><a href="GHC.Rename.Names.html#findChildren"><span class="hs-identifier hs-var">findChildren</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv [GlobalRdrElt]
</span><a href="#local-6989586621681135504"><span class="hs-identifier hs-var">kids_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135500"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1262"></span><span>                </span><span class="hs-comment">-- A use of C implies a use of T,</span><span>
</span><span id="line-1263"></span><span>                </span><span class="hs-comment">-- if C was brought into scope by T(..) or T(C)</span><span>
</span><span id="line-1264"></span><span>
</span><span id="line-1265"></span><span>    </span><span class="hs-comment">-- Filter out the ones that are</span><span>
</span><span id="line-1266"></span><span>    </span><span class="hs-comment">--  (a) defined in this module, and</span><span>
</span><span id="line-1267"></span><span>    </span><span class="hs-comment">--  (b) not defined by a 'deriving' clause</span><span>
</span><span id="line-1268"></span><span>    </span><span class="hs-comment">-- The latter have an Internal Name, so we can filter them out easily</span><span>
</span><span id="line-1269"></span><span>    </span><span class="annot"><a href="#local-6989586621681135512"><span class="hs-identifier hs-type">unused_locals</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1270"></span><span>    </span><span id="local-6989586621681135512"><span class="annot"><span class="annottext">unused_locals :: Defs -&gt; [GlobalRdrElt]
</span><a href="#local-6989586621681135512"><span class="hs-identifier hs-var hs-var">unused_locals</span></a></span></span><span> </span><span id="local-6989586621681135497"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135497"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1271"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- Note that defined_and_used, defined_but_not_used</span><span>
</span><span id="line-1272"></span><span>          </span><span class="hs-comment">-- are both [GRE]; that's why we need defined_and_used</span><span>
</span><span id="line-1273"></span><span>          </span><span class="hs-comment">-- rather than just used_names</span><span>
</span><span id="line-1274"></span><span>          </span><span class="annot"><a href="#local-6989586621681135496"><span class="hs-identifier hs-type">_defined_and_used</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681135495"><span class="hs-identifier hs-type">defined_but_not_used</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1275"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681135496"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135496"><span class="hs-identifier hs-var">_defined_and_used</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135495"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135495"><span class="hs-identifier hs-var">defined_but_not_used</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1276"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Bool)
-&gt; [GlobalRdrElt] -&gt; ([GlobalRdrElt], [GlobalRdrElt])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Defs -&gt; GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135503"><span class="hs-identifier hs-var">gre_is_used</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Defs -&gt; Defs
</span><a href="#local-6989586621681135510"><span class="hs-identifier hs-var">used_names</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135497"><span class="hs-identifier hs-var">keep</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135506"><span class="hs-identifier hs-var">defined_names</span></a></span><span>
</span><span id="line-1277"></span><span>
</span><span id="line-1278"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Bool) -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135494"><span class="hs-identifier hs-var">is_unused_local</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135495"><span class="hs-identifier hs-var">defined_but_not_used</span></a></span><span>
</span><span id="line-1279"></span><span>    </span><span class="annot"><a href="#local-6989586621681135494"><span class="hs-identifier hs-type">is_unused_local</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1280"></span><span>    </span><span id="local-6989586621681135494"><span class="annot"><span class="annottext">is_unused_local :: GlobalRdrElt -&gt; Bool
</span><a href="#local-6989586621681135494"><span class="hs-identifier hs-var hs-var">is_unused_local</span></a></span></span><span> </span><span id="local-6989586621681135493"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135493"><span class="hs-identifier hs-var">gre</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isLocalGRE"><span class="hs-identifier hs-var">isLocalGRE</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135493"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135493"><span class="hs-identifier hs-var">gre</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1281"></span><span>
</span><span id="line-1282"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
              Missing signatures
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1287"></span><span>
</span><span id="line-1288"></span><span class="hs-comment">-- | Warn the user about top level binders that lack type signatures.</span><span>
</span><span id="line-1289"></span><span class="hs-comment">-- Called /after/ type inference, so that we can report the</span><span>
</span><span id="line-1290"></span><span class="hs-comment">-- inferred type of the function</span><span>
</span><span id="line-1291"></span><span class="annot"><a href="GHC.Rename.Names.html#warnMissingSignatures"><span class="hs-identifier hs-type">warnMissingSignatures</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1292"></span><span id="warnMissingSignatures"><span class="annot"><span class="annottext">warnMissingSignatures :: TcGblEnv -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnMissingSignatures"><span class="hs-identifier hs-var hs-var">warnMissingSignatures</span></a></span></span><span> </span><span id="local-6989586621681135491"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135491"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span>
</span><span id="line-1293"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135490"><span class="annot"><span class="annottext">exports :: Defs
</span><a href="#local-6989586621681135490"><span class="hs-identifier hs-var hs-var">exports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; Defs
</span><a href="GHC.Types.Avail.html#availsToNameSet"><span class="hs-identifier hs-var">availsToNameSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#tcg_exports"><span class="hs-identifier hs-var hs-var">tcg_exports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135491"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1294"></span><span>             </span><span id="local-6989586621681135487"><span class="annot"><span class="annottext">sig_ns :: Defs
</span><a href="#local-6989586621681135487"><span class="hs-identifier hs-var hs-var">sig_ns</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Defs
</span><a href="GHC.Tc.Types.html#tcg_sigs"><span class="hs-identifier hs-var hs-var">tcg_sigs</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135491"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-1295"></span><span>               </span><span class="hs-comment">-- We use sig_ns to exclude top-level bindings that are generated by GHC</span><span>
</span><span id="line-1296"></span><span>             </span><span id="local-6989586621681135485"><span class="annot"><span class="annottext">binds :: [IdP GhcTc]
</span><a href="#local-6989586621681135485"><span class="hs-identifier hs-var hs-var">binds</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsBindsLR GhcTc GhcTc -&gt; [IdP GhcTc]
forall p idR. CollectPass p =&gt; LHsBindsLR p idR -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectHsBindsBinders"><span class="hs-identifier hs-var">collectHsBindsBinders</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBindsLR GhcTc GhcTc -&gt; [IdP GhcTc])
-&gt; LHsBindsLR GhcTc GhcTc -&gt; [IdP GhcTc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; LHsBindsLR GhcTc GhcTc
</span><a href="GHC.Tc.Types.html#tcg_binds"><span class="hs-identifier hs-var hs-var">tcg_binds</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135491"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-1297"></span><span>             </span><span id="local-6989586621681135482"><span class="annot"><span class="annottext">pat_syns :: [PatSyn]
</span><a href="#local-6989586621681135482"><span class="hs-identifier hs-var hs-var">pat_syns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [PatSyn]
</span><a href="GHC.Tc.Types.html#tcg_patsyns"><span class="hs-identifier hs-var hs-var">tcg_patsyns</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135491"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-1298"></span><span>
</span><span id="line-1299"></span><span>         </span><span class="hs-comment">-- Warn about missing signatures</span><span>
</span><span id="line-1300"></span><span>         </span><span class="hs-comment">-- Do this only when we have a type to offer</span><span>
</span><span id="line-1301"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135480"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135480"><span class="hs-identifier hs-var">warn_missing_sigs</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. WarningFlag -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#woptM"><span class="hs-identifier hs-var">woptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingSignatures</span></a></span><span>
</span><span id="line-1302"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135477"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135477"><span class="hs-identifier hs-var">warn_only_exported</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. WarningFlag -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#woptM"><span class="hs-identifier hs-var">woptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingExportedSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingExportedSignatures</span></a></span><span>
</span><span id="line-1303"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135475"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135475"><span class="hs-identifier hs-var">warn_pat_syns</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. WarningFlag -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#woptM"><span class="hs-identifier hs-var">woptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingPatternSynonymSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingPatternSynonymSignatures</span></a></span><span>
</span><span id="line-1304"></span><span>
</span><span id="line-1305"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135473"><span class="annot"><span class="annottext">add_sig_warns :: IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135473"><span class="hs-identifier hs-var hs-var">add_sig_warns</span></a></span></span><span>
</span><span id="line-1306"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135477"><span class="hs-identifier hs-var">warn_only_exported</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135472"><span class="hs-identifier hs-var">add_warns</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingExportedSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingExportedSignatures</span></a></span><span>
</span><span id="line-1307"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135480"><span class="hs-identifier hs-var">warn_missing_sigs</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135472"><span class="hs-identifier hs-var">add_warns</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingSignatures</span></a></span><span>
</span><span id="line-1308"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135475"><span class="hs-identifier hs-var">warn_pat_syns</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135472"><span class="hs-identifier hs-var">add_warns</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingPatternSynonymSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingPatternSynonymSignatures</span></a></span><span>
</span><span id="line-1309"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1310"></span><span>
</span><span id="line-1311"></span><span>             </span><span id="local-6989586621681135472"><span class="annot"><span class="annottext">add_warns :: WarningFlag -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135472"><span class="hs-identifier hs-var hs-var">add_warns</span></a></span></span><span> </span><span id="local-6989586621681135471"><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135471"><span class="hs-identifier hs-var">flag</span></a></span></span><span>
</span><span id="line-1312"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135475"><span class="hs-identifier hs-var">warn_pat_syns</span></a></span><span>
</span><span id="line-1313"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PatSyn -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; [PatSyn] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135470"><span class="hs-identifier hs-var">add_pat_syn_warn</span></a></span><span> </span><span class="annot"><span class="annottext">[PatSyn]
</span><a href="#local-6989586621681135482"><span class="hs-identifier hs-var">pat_syns</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span>
</span><span id="line-1314"></span><span>                  </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135480"><span class="hs-identifier hs-var">warn_missing_sigs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135477"><span class="hs-identifier hs-var">warn_only_exported</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1315"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; [Id] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135469"><span class="hs-identifier hs-var">add_bind_warn</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[IdP GhcTc]
</span><a href="#local-6989586621681135485"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1316"></span><span>                </span><span class="hs-keyword">where</span><span>
</span><span id="line-1317"></span><span>                  </span><span id="local-6989586621681135470"><span class="annot"><span class="annottext">add_pat_syn_warn :: PatSyn -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135470"><span class="hs-identifier hs-var hs-var">add_pat_syn_warn</span></a></span></span><span> </span><span id="local-6989586621681135468"><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681135468"><span class="hs-identifier hs-var">p</span></a></span></span><span>
</span><span id="line-1318"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135467"><span class="hs-identifier hs-var">add_warn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135466"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1319"></span><span>                      </span><span class="annot"><span class="annottext">MsgDoc -&gt; Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Pattern synonym with no type signature:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1320"></span><span>                         </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;pattern&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc
forall a. NamedThing a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Types.Name.html#pprPrefixName"><span class="hs-identifier hs-var">pprPrefixName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135466"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135462"><span class="hs-identifier hs-var">pp_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1321"></span><span>                    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1322"></span><span>                      </span><span id="local-6989586621681135466"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681135466"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatSyn -&gt; Name
</span><a href="GHC.Core.PatSyn.html#patSynName"><span class="hs-identifier hs-var">patSynName</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681135468"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1323"></span><span>                      </span><span id="local-6989586621681135462"><span class="annot"><span class="annottext">pp_ty :: MsgDoc
</span><a href="#local-6989586621681135462"><span class="hs-identifier hs-var hs-var">pp_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatSyn -&gt; MsgDoc
</span><a href="GHC.Core.PatSyn.html#pprPatSynType"><span class="hs-identifier hs-var">pprPatSynType</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681135468"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1324"></span><span>
</span><span id="line-1325"></span><span>                  </span><span class="annot"><a href="#local-6989586621681135469"><span class="hs-identifier hs-type">add_bind_warn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html#IOEnv"><span class="hs-identifier hs-type">IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#Env"><span class="hs-identifier hs-type">Env</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1326"></span><span>                  </span><span id="local-6989586621681135469"><span class="annot"><span class="annottext">add_bind_warn :: Id -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135469"><span class="hs-identifier hs-var hs-var">add_bind_warn</span></a></span></span><span> </span><span id="local-6989586621681135459"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681135459"><span class="hs-identifier hs-var">id</span></a></span></span><span>
</span><span id="line-1327"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135458"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681135458"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TidyEnv
</span><a href="GHC.Tc.Utils.Env.html#tcInitTidyEnv"><span class="hs-identifier hs-var">tcInitTidyEnv</span></a></span><span>     </span><span class="hs-comment">-- Why not use emptyTidyEnv?</span><span>
</span><span id="line-1328"></span><span>                         </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135456"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681135456"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681135459"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1329"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135454"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681135454"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Type -&gt; (TidyEnv, Type)
</span><a href="GHC.Core.TyCo.Tidy.html#tidyOpenType"><span class="hs-identifier hs-var">tidyOpenType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681135458"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681135459"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1330"></span><span>                               </span><span id="local-6989586621681135451"><span class="annot"><span class="annottext">ty_msg :: MsgDoc
</span><a href="#local-6989586621681135451"><span class="hs-identifier hs-var hs-var">ty_msg</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; MsgDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprSigmaType"><span class="hs-identifier hs-var">pprSigmaType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681135454"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1331"></span><span>                         </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135467"><span class="hs-identifier hs-var">add_warn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135456"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1332"></span><span>                           </span><span class="annot"><span class="annottext">MsgDoc -&gt; Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Top-level binding with no type signature:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1333"></span><span>                              </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; MsgDoc
forall a. NamedThing a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Types.Name.html#pprPrefixName"><span class="hs-identifier hs-var">pprPrefixName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135456"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135451"><span class="hs-identifier hs-var">ty_msg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1334"></span><span>
</span><span id="line-1335"></span><span>                  </span><span id="local-6989586621681135467"><span class="annot"><span class="annottext">add_warn :: Name -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135467"><span class="hs-identifier hs-var hs-var">add_warn</span></a></span></span><span> </span><span id="local-6989586621681135449"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135449"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681135448"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135448"><span class="hs-identifier hs-var">msg</span></a></span></span><span>
</span><span id="line-1336"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135449"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135487"><span class="hs-identifier hs-var">sig_ns</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681135447"><span class="hs-identifier hs-var">export_check</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135449"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1337"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarnReason -&gt; SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnAt"><span class="hs-identifier hs-var">addWarnAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135471"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
forall a. NamedThing a =&gt; a -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#getSrcSpan"><span class="hs-identifier hs-var">getSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135449"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135448"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1338"></span><span>
</span><span id="line-1339"></span><span>                  </span><span id="local-6989586621681135447"><span class="annot"><span class="annottext">export_check :: Name -&gt; Bool
</span><a href="#local-6989586621681135447"><span class="hs-identifier hs-var hs-var">export_check</span></a></span></span><span> </span><span id="local-6989586621681135445"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135445"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1340"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681135477"><span class="hs-identifier hs-var">warn_only_exported</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135445"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135490"><span class="hs-identifier hs-var">exports</span></a></span><span>
</span><span id="line-1341"></span><span>
</span><span id="line-1342"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="#local-6989586621681135473"><span class="hs-identifier hs-var">add_sig_warns</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1343"></span><span>
</span><span id="line-1344"></span><span>
</span><span id="line-1345"></span><span class="hs-comment">{-
*********************************************************
*                                                       *
\subsection{Unused imports}
*                                                       *
*********************************************************

This code finds which import declarations are unused.  The
specification and implementation notes are here:
  https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/unused-imports

See also Note [Choosing the best import declaration] in GHC.Types.Name.Reader
-}</span><span>
</span><span id="line-1358"></span><span>
</span><span id="line-1359"></span><span class="hs-keyword">type</span><span> </span><span id="ImportDeclUsage"><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-var">ImportDeclUsage</span></a></span></span><span>
</span><span id="line-1360"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>   </span><span class="hs-comment">-- The import declaration</span><span>
</span><span id="line-1361"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- What *is* used (normalised)</span><span>
</span><span id="line-1362"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">)</span><span>            </span><span class="hs-comment">-- What is imported but *not* used</span><span>
</span><span id="line-1363"></span><span>
</span><span id="line-1364"></span><span class="annot"><a href="GHC.Rename.Names.html#warnUnusedImportDecls"><span class="hs-identifier hs-type">warnUnusedImportDecls</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1365"></span><span id="warnUnusedImportDecls"><span class="annot"><span class="annottext">warnUnusedImportDecls :: TcGblEnv -&gt; HscSource -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnUnusedImportDecls"><span class="hs-identifier hs-var hs-var">warnUnusedImportDecls</span></a></span></span><span> </span><span id="local-6989586621681135444"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135444"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span> </span><span id="local-6989586621681135443"><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135443"><span class="hs-identifier hs-var">hsc_src</span></a></span></span><span>
</span><span id="line-1366"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135442"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135442"><span class="hs-identifier hs-var">uses</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IORef [GlobalRdrElt]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [GlobalRdrElt]
forall a env. IORef a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#readMutVar"><span class="hs-identifier hs-var">readMutVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; IORef [GlobalRdrElt]
</span><a href="GHC.Tc.Types.html#tcg_used_gres"><span class="hs-identifier hs-var hs-var">tcg_used_gres</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135444"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1367"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135439"><span class="annot"><span class="annottext">user_imports :: [LImportDecl GhcRn]
</span><a href="#local-6989586621681135439"><span class="hs-identifier hs-var hs-var">user_imports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcRn -&gt; Bool)
-&gt; [LImportDecl GhcRn] -&gt; [LImportDecl GhcRn]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span>
</span><span id="line-1368"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Bool
forall pass. ImportDecl pass -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#ideclImplicit"><span class="hs-identifier hs-var hs-var">ideclImplicit</span></a></span><span> </span><span class="annot"><span class="annottext">(ImportDecl GhcRn -&gt; Bool)
-&gt; (LImportDecl GhcRn -&gt; ImportDecl GhcRn)
-&gt; LImportDecl GhcRn
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcRn -&gt; ImportDecl GhcRn
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1369"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LImportDecl GhcRn]
</span><a href="GHC.Tc.Types.html#tcg_rn_imports"><span class="hs-identifier hs-var hs-var">tcg_rn_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135444"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1370"></span><span>                </span><span class="hs-comment">-- This whole function deals only with *user* imports</span><span>
</span><span id="line-1371"></span><span>                </span><span class="hs-comment">-- both for warning about unnecessary ones, and for</span><span>
</span><span id="line-1372"></span><span>                </span><span class="hs-comment">-- deciding the minimal ones</span><span>
</span><span id="line-1373"></span><span>             </span><span id="local-6989586621681135436"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681135436"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681135444"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-1374"></span><span>             </span><span id="local-6989586621681135435"><span class="annot"><span class="annottext">fld_env :: NameEnv (FastString, Name)
</span><a href="#local-6989586621681135435"><span class="hs-identifier hs-var hs-var">fld_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; NameEnv (FastString, Name)
</span><a href="GHC.Rename.Utils.html#mkFieldEnv"><span class="hs-identifier hs-var">mkFieldEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681135436"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-1375"></span><span>
</span><span id="line-1376"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681135434"><span class="hs-identifier hs-type">usage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-type">ImportDeclUsage</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1377"></span><span>             </span><span id="local-6989586621681135434"><span class="annot"><span class="annottext">usage :: [ImportDeclUsage]
</span><a href="#local-6989586621681135434"><span class="hs-identifier hs-var hs-var">usage</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcRn] -&gt; [GlobalRdrElt] -&gt; [ImportDeclUsage]
</span><a href="GHC.Rename.Names.html#findImportUsage"><span class="hs-identifier hs-var">findImportUsage</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681135439"><span class="hs-identifier hs-var">user_imports</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135442"><span class="hs-identifier hs-var">uses</span></a></span><span>
</span><span id="line-1378"></span><span>
</span><span id="line-1379"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#traceRn"><span class="hs-identifier hs-var">traceRn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;warnUnusedImportDecls&quot;</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1380"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Uses:&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135442"><span class="hs-identifier hs-var">uses</span></a></span><span>
</span><span id="line-1381"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Import usage&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage]
</span><a href="#local-6989586621681135434"><span class="hs-identifier hs-var">usage</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1382"></span><span>
</span><span id="line-1383"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">WarningFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
WarningFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenWOptM"><span class="hs-identifier hs-var">whenWOptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnUnusedImports"><span class="hs-identifier hs-var">Opt_WarnUnusedImports</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1384"></span><span>         </span><span class="annot"><span class="annottext">(ImportDeclUsage -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; [ImportDeclUsage] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag
-&gt; NameEnv (FastString, Name)
-&gt; ImportDeclUsage
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnUnusedImport"><span class="hs-identifier hs-var">warnUnusedImport</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnUnusedImports"><span class="hs-identifier hs-var">Opt_WarnUnusedImports</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv (FastString, Name)
</span><a href="#local-6989586621681135435"><span class="hs-identifier hs-var">fld_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage]
</span><a href="#local-6989586621681135434"><span class="hs-identifier hs-var">usage</span></a></span><span>
</span><span id="line-1385"></span><span>
</span><span id="line-1386"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">GeneralFlag
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall gbl lcl.
GeneralFlag -&gt; TcRnIf gbl lcl () -&gt; TcRnIf gbl lcl ()
</span><a href="GHC.Tc.Utils.Monad.html#whenGOptM"><span class="hs-identifier hs-var">whenGOptM</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_minimal_imports"><span class="hs-identifier hs-var">Opt_D_dump_minimal_imports</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) ()
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1387"></span><span>         </span><span class="annot"><span class="annottext">HscSource -&gt; [ImportDeclUsage] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#printMinimalImports"><span class="hs-identifier hs-var">printMinimalImports</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135443"><span class="hs-identifier hs-var">hsc_src</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage]
</span><a href="#local-6989586621681135434"><span class="hs-identifier hs-var">usage</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1388"></span><span>
</span><span id="line-1389"></span><span class="annot"><a href="GHC.Rename.Names.html#findImportUsage"><span class="hs-identifier hs-type">findImportUsage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1390"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1391"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-type">ImportDeclUsage</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1392"></span><span>
</span><span id="line-1393"></span><span id="findImportUsage"><span class="annot"><span class="annottext">findImportUsage :: [LImportDecl GhcRn] -&gt; [GlobalRdrElt] -&gt; [ImportDeclUsage]
</span><a href="GHC.Rename.Names.html#findImportUsage"><span class="hs-identifier hs-var hs-var">findImportUsage</span></a></span></span><span> </span><span id="local-6989586621681135429"><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681135429"><span class="hs-identifier hs-var">imports</span></a></span></span><span> </span><span id="local-6989586621681135428"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135428"><span class="hs-identifier hs-var">used_gres</span></a></span></span><span>
</span><span id="line-1394"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcRn -&gt; ImportDeclUsage)
-&gt; [LImportDecl GhcRn] -&gt; [ImportDeclUsage]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcRn -&gt; ImportDeclUsage
</span><a href="#local-6989586621681135427"><span class="hs-identifier hs-var">unused_decl</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681135429"><span class="hs-identifier hs-var">imports</span></a></span><span>
</span><span id="line-1395"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1396"></span><span>    </span><span class="annot"><a href="#local-6989586621681135426"><span class="hs-identifier hs-type">import_usage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#ImportMap"><span class="hs-identifier hs-type">ImportMap</span></a></span><span>
</span><span id="line-1397"></span><span>    </span><span id="local-6989586621681135426"><span class="annot"><span class="annottext">import_usage :: ImportMap
</span><a href="#local-6989586621681135426"><span class="hs-identifier hs-var hs-var">import_usage</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; ImportMap
</span><a href="GHC.Rename.Names.html#mkImportMap"><span class="hs-identifier hs-var">mkImportMap</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135428"><span class="hs-identifier hs-var">used_gres</span></a></span><span>
</span><span id="line-1398"></span><span>
</span><span id="line-1399"></span><span>    </span><span id="local-6989586621681135427"><span class="annot"><span class="annottext">unused_decl :: LImportDecl GhcRn -&gt; ImportDeclUsage
</span><a href="#local-6989586621681135427"><span class="hs-identifier hs-var hs-var">unused_decl</span></a></span></span><span> </span><span id="local-6989586621681135421"><span class="annot"><span class="annottext">decl :: LImportDecl GhcRn
</span><a href="#local-6989586621681135421"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135420"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135420"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclHiding :: forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var">ideclHiding</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135419"><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcRn])
</span><a href="#local-6989586621681135419"><span class="hs-identifier hs-var">imps</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1400"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LImportDecl GhcRn
</span><a href="#local-6989586621681135421"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135418"><span class="hs-identifier hs-var">used_gres</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Defs -&gt; [Name]
</span><a href="GHC.Types.Name.Set.html#nameSetElemsStable"><span class="hs-identifier hs-var">nameSetElemsStable</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135416"><span class="hs-identifier hs-var">unused_imps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1401"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1402"></span><span>        </span><span id="local-6989586621681135418"><span class="annot"><span class="annottext">used_gres :: [GlobalRdrElt]
</span><a href="#local-6989586621681135418"><span class="hs-identifier hs-var hs-var">used_gres</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcLoc -&gt; ImportMap -&gt; Maybe [GlobalRdrElt]
forall a. SrcLoc -&gt; Map RealSrcLoc a -&gt; Maybe a
</span><a href="GHC.Types.SrcLoc.html#lookupSrcLoc"><span class="hs-identifier hs-var">lookupSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanEnd"><span class="hs-identifier hs-var">srcSpanEnd</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135420"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ImportMap
</span><a href="#local-6989586621681135426"><span class="hs-identifier hs-var">import_usage</span></a></span><span>
</span><span id="line-1403"></span><span>                               </span><span class="hs-comment">-- srcSpanEnd: see Note [The ImportMap]</span><span>
</span><span id="line-1404"></span><span>                    </span><span class="annot"><span class="annottext">Maybe [GlobalRdrElt] -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1405"></span><span>
</span><span id="line-1406"></span><span>        </span><span id="local-6989586621681135413"><span class="annot"><span class="annottext">used_names :: Defs
</span><a href="#local-6989586621681135413"><span class="hs-identifier hs-var hs-var">used_names</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#mkNameSet"><span class="hs-identifier hs-var">mkNameSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Name) -&gt; [GlobalRdrElt] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span>      </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span>        </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135418"><span class="hs-identifier hs-var">used_gres</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1407"></span><span>        </span><span id="local-6989586621681135411"><span class="annot"><span class="annottext">used_parents :: Defs
</span><a href="#local-6989586621681135411"><span class="hs-identifier hs-var hs-var">used_parents</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#mkNameSet"><span class="hs-identifier hs-var">mkNameSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Maybe Name) -&gt; [GlobalRdrElt] -&gt; [Name]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Maybe Name
</span><a href="GHC.Types.Name.Reader.html#greParent_maybe"><span class="hs-identifier hs-var">greParent_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135418"><span class="hs-identifier hs-var">used_gres</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1408"></span><span>
</span><span id="line-1409"></span><span>        </span><span id="local-6989586621681135416"><span class="annot"><span class="annottext">unused_imps :: Defs
</span><a href="#local-6989586621681135416"><span class="hs-identifier hs-var hs-var">unused_imps</span></a></span></span><span>   </span><span class="hs-comment">-- Not trivial; see eg #7454</span><span>
</span><span id="line-1410"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcRn])
</span><a href="#local-6989586621681135419"><span class="hs-identifier hs-var">imps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1411"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135408"><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135408"><span class="hs-identifier hs-var">imp_ies</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1412"></span><span>                                 </span><span class="annot"><span class="annottext">(LIE GhcRn -&gt; Defs -&gt; Defs) -&gt; Defs -&gt; [LIE GhcRn] -&gt; Defs
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcRn -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135407"><span class="hs-identifier hs-var">add_unused</span></a></span><span> </span><span class="annot"><span class="annottext">(IE GhcRn -&gt; Defs -&gt; Defs)
-&gt; (LIE GhcRn -&gt; IE GhcRn) -&gt; LIE GhcRn -&gt; Defs -&gt; Defs
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LIE GhcRn -&gt; IE GhcRn
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135408"><span class="hs-identifier hs-var">imp_ies</span></a></span><span>
</span><span id="line-1413"></span><span>              </span><span id="local-6989586621681135406"><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcRn])
</span><a href="#local-6989586621681135406"><span class="hs-identifier hs-var">_other</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span> </span><span class="hs-comment">-- No explicit import list =&gt; no unused-name list</span><span>
</span><span id="line-1414"></span><span>
</span><span id="line-1415"></span><span>        </span><span class="annot"><a href="#local-6989586621681135407"><span class="hs-identifier hs-type">add_unused</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span>
</span><span id="line-1416"></span><span>        </span><span id="local-6989586621681135407"><span class="annot"><span class="annottext">add_unused :: IE GhcRn -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135407"><span class="hs-identifier hs-var hs-var">add_unused</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEVar"><span class="hs-identifier hs-type">IEVar</span></a></span><span> </span><span class="annot"><span class="annottext">XIEVar GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135405"><span class="annot"><span class="annottext">LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135405"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span>      </span><span id="local-6989586621681135404"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135404"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135403"><span class="hs-identifier hs-var">add_unused_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name)
LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135405"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135404"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1417"></span><span>        </span><span class="annot"><a href="#local-6989586621681135407"><span class="hs-identifier hs-var">add_unused</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingAbs"><span class="hs-identifier hs-type">IEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingAbs GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135402"><span class="annot"><span class="annottext">LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135402"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681135401"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135401"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135403"><span class="hs-identifier hs-var">add_unused_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name)
LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135402"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135401"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1418"></span><span>        </span><span class="annot"><a href="#local-6989586621681135407"><span class="hs-identifier hs-var">add_unused</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-type">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingAll GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135400"><span class="annot"><span class="annottext">LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135400"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681135399"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135399"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135398"><span class="hs-identifier hs-var">add_unused_all</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name)
LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135400"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135399"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1419"></span><span>        </span><span class="annot"><a href="#local-6989586621681135407"><span class="hs-identifier hs-var">add_unused</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEThingWith"><span class="hs-identifier hs-type">IEThingWith</span></a></span><span> </span><span class="annot"><span class="annottext">XIEThingWith GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135397"><span class="annot"><span class="annottext">LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135397"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681135396"><span class="annot"><span class="annottext">IEWildcard
</span><a href="#local-6989586621681135396"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621681135395"><span class="annot"><span class="annottext">[LIEWrappedName (IdP GhcRn)]
</span><a href="#local-6989586621681135395"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681135394"><span class="annot"><span class="annottext">[Located (FieldLbl (IdP GhcRn))]
</span><a href="#local-6989586621681135394"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681135393"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135393"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1420"></span><span>          </span><span class="annot"><span class="annottext">Defs -&gt; Defs
</span><a href="#local-6989586621681135392"><span class="hs-identifier hs-var">add_wc_all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135391"><span class="hs-identifier hs-var">add_unused_with</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135390"><span class="hs-identifier hs-var">pn</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135389"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135393"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1421"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681135390"><span class="annot"><span class="annottext">pn :: Name
</span><a href="#local-6989586621681135390"><span class="hs-identifier hs-var hs-var">pn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name)
LIEWrappedName (IdP GhcRn)
</span><a href="#local-6989586621681135397"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1422"></span><span>                </span><span id="local-6989586621681135389"><span class="annot"><span class="annottext">xs :: [Name]
</span><a href="#local-6989586621681135389"><span class="hs-identifier hs-var hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (IEWrappedName Name) -&gt; Name)
-&gt; [GenLocated SrcSpan (IEWrappedName Name)] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IEWrappedName Name) -&gt; Name
forall name. LIEWrappedName name -&gt; name
</span><a href="GHC.Hs.ImpExp.html#lieWrappedName"><span class="hs-identifier hs-var">lieWrappedName</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (IEWrappedName Name)]
[LIEWrappedName (IdP GhcRn)]
</span><a href="#local-6989586621681135395"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; [Name] -&gt; [Name]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(Located FieldLabel -&gt; Name) -&gt; [Located FieldLabel] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FieldLabel -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">(FieldLabel -&gt; Name)
-&gt; (Located FieldLabel -&gt; FieldLabel) -&gt; Located FieldLabel -&gt; Name
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located FieldLabel -&gt; FieldLabel
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located FieldLabel]
[Located (FieldLbl (IdP GhcRn))]
</span><a href="#local-6989586621681135394"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-1423"></span><span>                </span><span id="local-6989586621681135392"><span class="annot"><span class="annottext">add_wc_all :: Defs -&gt; Defs
</span><a href="#local-6989586621681135392"><span class="hs-identifier hs-var hs-var">add_wc_all</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IEWildcard
</span><a href="#local-6989586621681135396"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1424"></span><span>                            </span><span class="annot"><span class="annottext">IEWildcard
</span><a href="GHC.Hs.ImpExp.html#NoIEWildcard"><span class="hs-identifier hs-var">NoIEWildcard</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Defs -&gt; Defs
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1425"></span><span>                            </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IEWildcard"><span class="hs-identifier hs-type">IEWildcard</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135398"><span class="hs-identifier hs-var">add_unused_all</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135390"><span class="hs-identifier hs-var">pn</span></a></span><span>
</span><span id="line-1426"></span><span>        </span><span class="annot"><a href="#local-6989586621681135407"><span class="hs-identifier hs-var">add_unused</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135385"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135385"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135385"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1427"></span><span>
</span><span id="line-1428"></span><span>        </span><span id="local-6989586621681135403"><span class="annot"><span class="annottext">add_unused_name :: Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135403"><span class="hs-identifier hs-var hs-var">add_unused_name</span></a></span></span><span> </span><span id="local-6989586621681135384"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135384"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681135383"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135383"><span class="hs-identifier hs-var">acc</span></a></span></span><span>
</span><span id="line-1429"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135384"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135413"><span class="hs-identifier hs-var">used_names</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135383"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1430"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135383"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Defs -&gt; Name -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#extendNameSet"><span class="hs-operator hs-var">`extendNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135384"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1431"></span><span>        </span><span id="local-6989586621681135398"><span class="annot"><span class="annottext">add_unused_all :: Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135398"><span class="hs-identifier hs-var hs-var">add_unused_all</span></a></span></span><span> </span><span id="local-6989586621681135381"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135381"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681135380"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135380"><span class="hs-identifier hs-var">acc</span></a></span></span><span>
</span><span id="line-1432"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135381"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135413"><span class="hs-identifier hs-var">used_names</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135380"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1433"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135381"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135411"><span class="hs-identifier hs-var">used_parents</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135380"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-1434"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135380"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Defs -&gt; Name -&gt; Defs
</span><a href="GHC.Types.Name.Set.html#extendNameSet"><span class="hs-operator hs-var">`extendNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135381"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1435"></span><span>        </span><span id="local-6989586621681135391"><span class="annot"><span class="annottext">add_unused_with :: Name -&gt; [Name] -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135391"><span class="hs-identifier hs-var hs-var">add_unused_with</span></a></span></span><span> </span><span id="local-6989586621681135379"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135379"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681135378"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135378"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681135377"><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135377"><span class="hs-identifier hs-var">acc</span></a></span></span><span>
</span><span id="line-1436"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135376"><span class="hs-identifier hs-var">acc1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135378"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135403"><span class="hs-identifier hs-var">add_unused_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135379"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135376"><span class="hs-identifier hs-var">acc1</span></a></span><span>
</span><span id="line-1437"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135376"><span class="hs-identifier hs-var">acc1</span></a></span><span>
</span><span id="line-1438"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-1439"></span><span>            </span><span id="local-6989586621681135376"><span class="annot"><span class="annottext">acc1 :: Defs
</span><a href="#local-6989586621681135376"><span class="hs-identifier hs-var hs-var">acc1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Defs -&gt; Defs) -&gt; Defs -&gt; [Name] -&gt; Defs
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Defs -&gt; Defs
</span><a href="#local-6989586621681135403"><span class="hs-identifier hs-var">add_unused_name</span></a></span><span> </span><span class="annot"><span class="annottext">Defs
</span><a href="#local-6989586621681135377"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135378"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-1440"></span><span>       </span><span class="hs-comment">-- If you use 'signum' from Num, then the user may well have</span><span>
</span><span id="line-1441"></span><span>       </span><span class="hs-comment">-- imported Num(signum).  We don't want to complain that</span><span>
</span><span id="line-1442"></span><span>       </span><span class="hs-comment">-- Num is not itself mentioned.  Hence the two cases in add_unused_with.</span><span>
</span><span id="line-1443"></span><span>
</span><span id="line-1444"></span><span>
</span><span id="line-1445"></span><span class="hs-comment">{- Note [The ImportMap]
~~~~~~~~~~~~~~~~~~~~~~~
The ImportMap is a short-lived intermediate data structure records, for
each import declaration, what stuff brought into scope by that
declaration is actually used in the module.

The SrcLoc is the location of the END of a particular 'import'
declaration.  Why *END*?  Because we don't want to get confused
by the implicit Prelude import. Consider (#7476) the module
    import Foo( foo )
    main = print foo
There is an implicit 'import Prelude(print)', and it gets a SrcSpan
of line 1:1 (just the point, not a span). If we use the *START* of
the SrcSpan to identify the import decl, we'll confuse the implicit
import Prelude with the explicit 'import Foo'.  So we use the END.
It's just a cheap hack; we could equally well use the Span too.

The [GlobalRdrElt] are the things imported from that decl.
-}</span><span>
</span><span id="line-1464"></span><span>
</span><span id="line-1465"></span><span class="hs-keyword">type</span><span> </span><span id="ImportMap"><span class="annot"><a href="GHC.Rename.Names.html#ImportMap"><span class="hs-identifier hs-var">ImportMap</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcLoc"><span class="hs-identifier hs-type">RealSrcLoc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- See [The ImportMap]</span><span>
</span><span id="line-1466"></span><span>     </span><span class="hs-comment">-- If loc :-&gt; gres, then</span><span>
</span><span id="line-1467"></span><span>     </span><span class="hs-comment">--   'loc' = the end loc of the bestImport of each GRE in 'gres'</span><span>
</span><span id="line-1468"></span><span>
</span><span id="line-1469"></span><span class="annot"><a href="GHC.Rename.Names.html#mkImportMap"><span class="hs-identifier hs-type">mkImportMap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#ImportMap"><span class="hs-identifier hs-type">ImportMap</span></a></span><span>
</span><span id="line-1470"></span><span class="hs-comment">-- For each of a list of used GREs, find all the import decls that brought</span><span>
</span><span id="line-1471"></span><span class="hs-comment">-- it into scope; choose one of them (bestImport), and record</span><span>
</span><span id="line-1472"></span><span class="hs-comment">-- the RdrName in that import decl's entry in the ImportMap</span><span>
</span><span id="line-1473"></span><span id="mkImportMap"><span class="annot"><span class="annottext">mkImportMap :: [GlobalRdrElt] -&gt; ImportMap
</span><a href="GHC.Rename.Names.html#mkImportMap"><span class="hs-identifier hs-var hs-var">mkImportMap</span></a></span></span><span> </span><span id="local-6989586621681135375"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135375"><span class="hs-identifier hs-var">gres</span></a></span></span><span>
</span><span id="line-1474"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; ImportMap -&gt; ImportMap)
-&gt; ImportMap -&gt; [GlobalRdrElt] -&gt; ImportMap
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; ImportMap -&gt; ImportMap
</span><a href="#local-6989586621681135374"><span class="hs-identifier hs-var">add_one</span></a></span><span> </span><span class="annot"><span class="annottext">ImportMap
forall k a. Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#empty"><span class="hs-identifier hs-var">Map.empty</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135375"><span class="hs-identifier hs-var">gres</span></a></span><span>
</span><span id="line-1475"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1476"></span><span>    </span><span id="local-6989586621681135374"><span class="annot"><span class="annottext">add_one :: GlobalRdrElt -&gt; ImportMap -&gt; ImportMap
</span><a href="#local-6989586621681135374"><span class="hs-identifier hs-var hs-var">add_one</span></a></span></span><span> </span><span id="local-6989586621681135370"><span class="annot"><span class="annottext">gre :: GlobalRdrElt
</span><a href="#local-6989586621681135370"><span class="hs-identifier hs-var">gre</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GRE"><span class="hs-identifier hs-type">GRE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">gre_imp :: GlobalRdrElt -&gt; [ImportSpec]
</span><a href="GHC.Types.Name.Reader.html#gre_imp"><span class="hs-identifier hs-var">gre_imp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135368"><span class="annot"><span class="annottext">[ImportSpec]
</span><a href="#local-6989586621681135368"><span class="hs-identifier hs-var">imp_specs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681135367"><span class="annot"><span class="annottext">ImportMap
</span><a href="#local-6989586621681135367"><span class="hs-identifier hs-var">imp_map</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1477"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanEnd"><span class="hs-identifier hs-var">srcSpanEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; SrcSpan
</span><a href="GHC.Types.Name.Reader.html#is_dloc"><span class="hs-identifier hs-var hs-var">is_dloc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportSpec -&gt; ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#is_decl"><span class="hs-identifier hs-var hs-var">is_decl</span></a></span><span> </span><span class="annot"><span class="annottext">ImportSpec
</span><a href="#local-6989586621681135366"><span class="hs-identifier hs-var">best_imp_spec</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1478"></span><span>                              </span><span class="hs-comment">-- For srcSpanEnd see Note [The ImportMap]</span><span>
</span><span id="line-1479"></span><span>       </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcLoc"><span class="hs-identifier hs-type">RealSrcLoc</span></a></span><span> </span><span id="local-6989586621681135364"><span class="annot"><span class="annottext">RealSrcLoc
</span><a href="#local-6989586621681135364"><span class="hs-identifier hs-var">decl_loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe BufPos
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([GlobalRdrElt] -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt])
-&gt; RealSrcLoc -&gt; [GlobalRdrElt] -&gt; ImportMap -&gt; ImportMap
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#insertWith"><span class="hs-identifier hs-var">Map.insertWith</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
</span><a href="#local-6989586621681135362"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcLoc
</span><a href="#local-6989586621681135364"><span class="hs-identifier hs-var">decl_loc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135370"><span class="hs-identifier hs-var">gre</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">ImportMap
</span><a href="#local-6989586621681135367"><span class="hs-identifier hs-var">imp_map</span></a></span><span>
</span><span id="line-1480"></span><span>       </span><span class="annot"><a href="GHC.Types.SrcLoc.html#UnhelpfulLoc"><span class="hs-identifier hs-type">UnhelpfulLoc</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ImportMap
</span><a href="#local-6989586621681135367"><span class="hs-identifier hs-var">imp_map</span></a></span><span>
</span><span id="line-1481"></span><span>       </span><span class="hs-keyword">where</span><span>
</span><span id="line-1482"></span><span>          </span><span id="local-6989586621681135366"><span class="annot"><span class="annottext">best_imp_spec :: ImportSpec
</span><a href="#local-6989586621681135366"><span class="hs-identifier hs-var hs-var">best_imp_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ImportSpec] -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#bestImport"><span class="hs-identifier hs-var">bestImport</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportSpec]
</span><a href="#local-6989586621681135368"><span class="hs-identifier hs-var">imp_specs</span></a></span><span>
</span><span id="line-1483"></span><span>          </span><span id="local-6989586621681135362"><span class="annot"><span class="annottext">add :: [GlobalRdrElt] -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
</span><a href="#local-6989586621681135362"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135359"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135359"><span class="hs-identifier hs-var">gres</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135370"><span class="hs-identifier hs-var">gre</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; [GlobalRdrElt] -&gt; [GlobalRdrElt]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135359"><span class="hs-identifier hs-var">gres</span></a></span><span>
</span><span id="line-1484"></span><span>
</span><span id="line-1485"></span><span class="annot"><a href="GHC.Rename.Names.html#warnUnusedImport"><span class="hs-identifier hs-type">warnUnusedImport</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabelString"><span class="hs-identifier hs-type">FieldLabelString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1486"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-type">ImportDeclUsage</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1487"></span><span id="warnUnusedImport"><span class="annot"><span class="annottext">warnUnusedImport :: WarningFlag
-&gt; NameEnv (FastString, Name)
-&gt; ImportDeclUsage
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#warnUnusedImport"><span class="hs-identifier hs-var hs-var">warnUnusedImport</span></a></span></span><span> </span><span id="local-6989586621681135357"><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135357"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681135356"><span class="annot"><span class="annottext">NameEnv (FastString, Name)
</span><a href="#local-6989586621681135356"><span class="hs-identifier hs-var">fld_env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135355"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135355"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681135354"><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135353"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135353"><span class="hs-identifier hs-var">used</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135352"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135352"><span class="hs-identifier hs-var">unused</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1488"></span><span>
</span><span id="line-1489"></span><span>  </span><span class="hs-comment">-- Do not warn for 'import M()'</span><span>
</span><span id="line-1490"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Maybe (Bool, Located [LIE GhcRn])
forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var hs-var">ideclHiding</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1491"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1492"></span><span>
</span><span id="line-1493"></span><span>  </span><span class="hs-comment">-- Note [Do not warn about Prelude hiding]</span><span>
</span><span id="line-1494"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135351"><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135351"><span class="hs-identifier hs-var">hides</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Maybe (Bool, Located [LIE GhcRn])
forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var hs-var">ideclHiding</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1495"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LIE GhcRn] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135351"><span class="hs-identifier hs-var">hides</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1496"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="GHC.Builtin.Names.html#pRELUDE_NAME"><span class="hs-identifier hs-var">pRELUDE_NAME</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1497"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1498"></span><span>
</span><span id="line-1499"></span><span>  </span><span class="hs-comment">-- Nothing used; drop entire declaration</span><span>
</span><span id="line-1500"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135353"><span class="hs-identifier hs-var">used</span></a></span><span>
</span><span id="line-1501"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnAt"><span class="hs-identifier hs-var">addWarnAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135357"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135355"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135349"><span class="hs-identifier hs-var">msg1</span></a></span><span>
</span><span id="line-1502"></span><span>
</span><span id="line-1503"></span><span>  </span><span class="hs-comment">-- Everything imported is used; nop</span><span>
</span><span id="line-1504"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135352"><span class="hs-identifier hs-var">unused</span></a></span><span>
</span><span id="line-1505"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1506"></span><span>
</span><span id="line-1507"></span><span>  </span><span class="hs-comment">-- Only one import is unused, with `SrcSpan` covering only the unused item instead of</span><span>
</span><span id="line-1508"></span><span>  </span><span class="hs-comment">-- the whole import statement</span><span>
</span><span id="line-1509"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135348"><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135348"><span class="hs-identifier hs-var">imports</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Maybe (Bool, Located [LIE GhcRn])
forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var hs-var">ideclHiding</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1510"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135352"><span class="hs-identifier hs-var">unused</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1511"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135346"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135346"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">IE GhcRn
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LIE GhcRn -&gt; Bool) -&gt; [LIE GhcRn] -&gt; Maybe (LIE GhcRn)
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135345"><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135345"><span class="hs-identifier hs-var">ie</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcRn -&gt; IdP GhcRn
forall (p :: Pass). IE (GhcPass p) -&gt; IdP (GhcPass p)
</span><a href="GHC.Hs.ImpExp.html#ieName"><span class="hs-identifier hs-var">ieName</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcRn
</span><a href="#local-6989586621681135345"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135352"><span class="hs-identifier hs-var">unused</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135348"><span class="hs-identifier hs-var">imports</span></a></span><span>
</span><span id="line-1512"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnAt"><span class="hs-identifier hs-var">addWarnAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135357"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135346"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135343"><span class="hs-identifier hs-var">msg2</span></a></span><span>
</span><span id="line-1513"></span><span>
</span><span id="line-1514"></span><span>  </span><span class="hs-comment">-- Some imports are unused</span><span>
</span><span id="line-1515"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1516"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnAt"><span class="hs-identifier hs-var">addWarnAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681135357"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135355"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135343"><span class="hs-identifier hs-var">msg2</span></a></span><span>
</span><span id="line-1517"></span><span>
</span><span id="line-1518"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1519"></span><span>    </span><span id="local-6989586621681135349"><span class="annot"><span class="annottext">msg1 :: MsgDoc
</span><a href="#local-6989586621681135349"><span class="hs-identifier hs-var hs-var">msg1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135342"><span class="hs-identifier hs-var">pp_herald</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135341"><span class="hs-identifier hs-var">pp_mod</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135340"><span class="hs-identifier hs-var">is_redundant</span></a></span><span>
</span><span id="line-1520"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;except perhaps to import instances from&quot;</span></span><span>
</span><span id="line-1521"></span><span>                                   </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135341"><span class="hs-identifier hs-var">pp_mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1522"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;To import instances alone, use:&quot;</span></span><span>
</span><span id="line-1523"></span><span>                                   </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;import&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135341"><span class="hs-identifier hs-var">pp_mod</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1524"></span><span>    </span><span id="local-6989586621681135343"><span class="annot"><span class="annottext">msg2 :: MsgDoc
</span><a href="#local-6989586621681135343"><span class="hs-identifier hs-var hs-var">msg2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135342"><span class="hs-identifier hs-var">pp_herald</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135334"><span class="hs-identifier hs-var">sort_unused</span></a></span><span>
</span><span id="line-1525"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;from module&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135341"><span class="hs-identifier hs-var">pp_mod</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135340"><span class="hs-identifier hs-var">is_redundant</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1526"></span><span>    </span><span id="local-6989586621681135342"><span class="annot"><span class="annottext">pp_herald :: MsgDoc
</span><a href="#local-6989586621681135342"><span class="hs-identifier hs-var hs-var">pp_herald</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;The&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135333"><span class="hs-identifier hs-var">pp_qual</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;import of&quot;</span></span><span>
</span><span id="line-1527"></span><span>    </span><span id="local-6989586621681135333"><span class="annot"><span class="annottext">pp_qual :: MsgDoc
</span><a href="#local-6989586621681135333"><span class="hs-identifier hs-var hs-var">pp_qual</span></a></span></span><span>
</span><span id="line-1528"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ImportDeclQualifiedStyle -&gt; Bool
</span><a href="GHC.Hs.ImpExp.html#isImportDeclQualified"><span class="hs-identifier hs-var">isImportDeclQualified</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; ImportDeclQualifiedStyle
forall pass. ImportDecl pass -&gt; ImportDeclQualifiedStyle
</span><a href="GHC.Hs.ImpExp.html#ideclQualified"><span class="hs-identifier hs-var hs-var">ideclQualified</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;qualified&quot;</span></span><span>
</span><span id="line-1529"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-1530"></span><span>    </span><span id="local-6989586621681135341"><span class="annot"><span class="annottext">pp_mod :: MsgDoc
</span><a href="#local-6989586621681135341"><span class="hs-identifier hs-var hs-var">pp_mod</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135354"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1531"></span><span>    </span><span id="local-6989586621681135340"><span class="annot"><span class="annottext">is_redundant :: MsgDoc
</span><a href="#local-6989586621681135340"><span class="hs-identifier hs-var hs-var">is_redundant</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is redundant&quot;</span></span><span>
</span><span id="line-1532"></span><span>
</span><span id="line-1533"></span><span>    </span><span class="hs-comment">-- In warning message, pretty-print identifiers unqualified unconditionally</span><span>
</span><span id="line-1534"></span><span>    </span><span class="hs-comment">-- to improve the consistent for ambiguous/unambiguous identifiers.</span><span>
</span><span id="line-1535"></span><span>    </span><span class="hs-comment">-- See trac#14881.</span><span>
</span><span id="line-1536"></span><span>    </span><span id="local-6989586621681135332"><span class="annot"><span class="annottext">ppr_possible_field :: Name -&gt; MsgDoc
</span><a href="#local-6989586621681135332"><span class="hs-identifier hs-var hs-var">ppr_possible_field</span></a></span></span><span> </span><span id="local-6989586621681135331"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135331"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">NameEnv (FastString, Name) -&gt; Name -&gt; Maybe (FastString, Name)
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv (FastString, Name)
</span><a href="#local-6989586621681135356"><span class="hs-identifier hs-var">fld_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135331"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1537"></span><span>                               </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135330"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681135330"><span class="hs-identifier hs-var">fld</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135329"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135329"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc
</span><a href="GHC.Types.Name.html#pprNameUnqualified"><span class="hs-identifier hs-var">pprNameUnqualified</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135329"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681135330"><span class="hs-identifier hs-var">fld</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1538"></span><span>                               </span><span class="annot"><span class="annottext">Maybe (FastString, Name)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc
</span><a href="GHC.Types.Name.html#pprNameUnqualified"><span class="hs-identifier hs-var">pprNameUnqualified</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135331"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1539"></span><span>
</span><span id="line-1540"></span><span>    </span><span class="hs-comment">-- Print unused names in a deterministic (lexicographic) order</span><span>
</span><span id="line-1541"></span><span>    </span><span class="annot"><a href="#local-6989586621681135334"><span class="hs-identifier hs-type">sort_unused</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1542"></span><span>    </span><span id="local-6989586621681135334"><span class="annot"><span class="annottext">sort_unused :: MsgDoc
</span><a href="#local-6989586621681135334"><span class="hs-identifier hs-var hs-var">sort_unused</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; MsgDoc) -&gt; [Name] -&gt; MsgDoc
forall a. (a -&gt; MsgDoc) -&gt; [a] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#pprWithCommas"><span class="hs-identifier hs-var">pprWithCommas</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; MsgDoc
</span><a href="#local-6989586621681135332"><span class="hs-identifier hs-var">ppr_possible_field</span></a></span><span> </span><span class="annot"><span class="annottext">([Name] -&gt; MsgDoc) -&gt; [Name] -&gt; MsgDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1543"></span><span>                  </span><span class="annot"><span class="annottext">(Name -&gt; Name -&gt; Ordering) -&gt; [Name] -&gt; [Name]
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier hs-var">sortBy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; OccName) -&gt; Name -&gt; Name -&gt; Ordering
forall a b. Ord a =&gt; (b -&gt; a) -&gt; b -&gt; b -&gt; Ordering
</span><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier hs-var">comparing</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135352"><span class="hs-identifier hs-var">unused</span></a></span><span>
</span><span id="line-1544"></span><span>
</span><span id="line-1545"></span><span class="hs-comment">{-
Note [Do not warn about Prelude hiding]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We do not warn about
   import Prelude hiding( x, y )
because even if nothing else from Prelude is used, it may be essential to hide
x,y to avoid name-shadowing warnings.  Example (#9061)
   import Prelude hiding( log )
   f x = log where log = ()



Note [Printing minimal imports]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To print the minimal imports we walk over the user-supplied import
decls, and simply trim their import lists.  NB that

  * We do *not* change the 'qualified' or 'as' parts!

  * We do not discard a decl altogether; we might need instances
    from it.  Instead we just trim to an empty import list
-}</span><span>
</span><span id="line-1567"></span><span>
</span><span id="line-1568"></span><span class="annot"><a href="GHC.Rename.Names.html#getMinimalImports"><span class="hs-identifier hs-type">getMinimalImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-type">ImportDeclUsage</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1569"></span><span id="getMinimalImports"><span class="annot"><span class="annottext">getMinimalImports :: [ImportDeclUsage] -&gt; RnM [LImportDecl GhcRn]
</span><a href="GHC.Rename.Names.html#getMinimalImports"><span class="hs-identifier hs-var hs-var">getMinimalImports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ImportDeclUsage
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn))
-&gt; [ImportDeclUsage] -&gt; RnM [LImportDecl GhcRn]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDeclUsage
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn)
forall {t :: * -&gt; *} {a}.
Foldable t =&gt;
(LImportDecl GhcRn, [GlobalRdrElt], t a)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn)
</span><a href="#local-6989586621681135326"><span class="hs-identifier hs-var">mk_minimal</span></a></span><span>
</span><span id="line-1570"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1571"></span><span>    </span><span id="local-6989586621681135326"><span class="annot"><span class="annottext">mk_minimal :: (LImportDecl GhcRn, [GlobalRdrElt], t a)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn)
</span><a href="#local-6989586621681135326"><span class="hs-identifier hs-var hs-var">mk_minimal</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135312"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135312"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135311"><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135310"><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135310"><span class="hs-identifier hs-var">used_gres</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135309"><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621681135309"><span class="hs-identifier hs-var">unused</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1572"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">t a -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621681135309"><span class="hs-identifier hs-var">unused</span></a></span><span>
</span><span id="line-1573"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located [LIE GhcRn]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; Maybe (Bool, Located [LIE GhcRn])
forall pass. ImportDecl pass -&gt; Maybe (Bool, Located [LIE pass])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var hs-var">ideclHiding</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1574"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcRn
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; ImportDecl GhcRn -&gt; LImportDecl GhcRn
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135312"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1575"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1576"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclName :: forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var">ideclName</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135308"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135308"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span>
</span><span id="line-1577"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclSource :: forall pass. ImportDecl pass -&gt; IsBootInterface
</span><a href="GHC.Hs.ImpExp.html#ideclSource"><span class="hs-identifier hs-var">ideclSource</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135307"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681135307"><span class="hs-identifier hs-var">is_boot</span></a></span></span><span>
</span><span id="line-1578"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclPkgQual :: forall pass. ImportDecl pass -&gt; Maybe StringLiteral
</span><a href="GHC.Hs.ImpExp.html#ideclPkgQual"><span class="hs-identifier hs-var">ideclPkgQual</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681135306"><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681135306"><span class="hs-identifier hs-var">mb_pkg</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1579"></span><span>           </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135305"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135305"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MsgDoc
-&gt; ModuleName
-&gt; IsBootInterface
-&gt; Maybe FastString
-&gt; RnM ModIface
</span><a href="GHC.Iface.Load.html#loadSrcInterface"><span class="hs-identifier hs-var">loadSrcInterface</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135304"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135308"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681135307"><span class="hs-identifier hs-var">is_boot</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString)
-&gt; Maybe StringLiteral -&gt; Maybe FastString
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="#local-6989586621681135306"><span class="hs-identifier hs-var">mb_pkg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1580"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681135303"><span class="annot"><span class="annottext">used_avails :: [AvailInfo]
</span><a href="#local-6989586621681135303"><span class="hs-identifier hs-var hs-var">used_avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; [AvailInfo]
</span><a href="GHC.Types.Name.Reader.html#gresToAvailInfo"><span class="hs-identifier hs-var">gresToAvailInfo</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135310"><span class="hs-identifier hs-var">used_gres</span></a></span><span>
</span><span id="line-1581"></span><span>                 </span><span id="local-6989586621681135301"><span class="annot"><span class="annottext">lies :: [LIE GhcRn]
</span><a href="#local-6989586621681135301"><span class="hs-identifier hs-var hs-var">lies</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IE GhcRn -&gt; LIE GhcRn) -&gt; [IE GhcRn] -&gt; [LIE GhcRn]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; IE GhcRn -&gt; LIE GhcRn
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135312"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(AvailInfo -&gt; [IE GhcRn]) -&gt; [AvailInfo] -&gt; [IE GhcRn]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; AvailInfo -&gt; [IE GhcRn]
</span><a href="#local-6989586621681135300"><span class="hs-identifier hs-var">to_ie</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135305"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135303"><span class="hs-identifier hs-var">used_avails</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1582"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcRn
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LImportDecl GhcRn)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; ImportDecl GhcRn -&gt; LImportDecl GhcRn
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135312"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclHiding :: Maybe (Bool, Located [LIE GhcRn])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var">ideclHiding</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool, Located [LIE GhcRn]) -&gt; Maybe (Bool, Located [LIE GhcRn])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; [LIE GhcRn] -&gt; Located [LIE GhcRn]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135312"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcRn]
</span><a href="#local-6989586621681135301"><span class="hs-identifier hs-var">lies</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1583"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1584"></span><span>        </span><span id="local-6989586621681135304"><span class="annot"><span class="annottext">doc :: MsgDoc
</span><a href="#local-6989586621681135304"><span class="hs-identifier hs-var hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Compute minimal imports for&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcRn
</span><a href="#local-6989586621681135311"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-1585"></span><span>
</span><span id="line-1586"></span><span>    </span><span class="annot"><a href="#local-6989586621681135300"><span class="hs-identifier hs-type">to_ie</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1587"></span><span>    </span><span class="hs-comment">-- The main trick here is that if we're importing all the constructors</span><span>
</span><span id="line-1588"></span><span>    </span><span class="hs-comment">-- we want to say &quot;T(..)&quot;, but if we're importing only a subset we want</span><span>
</span><span id="line-1589"></span><span>    </span><span class="hs-comment">-- to say &quot;T(A,B,C)&quot;.  So we have to find out what the module exports.</span><span>
</span><span id="line-1590"></span><span>    </span><span id="local-6989586621681135300"><span class="annot"><span class="annottext">to_ie :: ModIface -&gt; AvailInfo -&gt; [IE GhcRn]
</span><a href="#local-6989586621681135300"><span class="hs-identifier hs-var hs-var">to_ie</span></a></span></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span id="local-6989586621681135299"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135299"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1591"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">XIEVar GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass. XIEVar pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEVar"><span class="hs-identifier hs-var">IEVar</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEVar GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135299"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1592"></span><span>    </span><span class="annot"><a href="#local-6989586621681135300"><span class="hs-identifier hs-var">to_ie</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135297"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135297"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681135296"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135296"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1593"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135297"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135296"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">XIEThingAbs GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass.
XIEThingAbs pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAbs"><span class="hs-identifier hs-var">IEThingAbs</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAbs GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135297"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1594"></span><span>    </span><span class="annot"><a href="#local-6989586621681135300"><span class="hs-identifier hs-var">to_ie</span></a></span><span> </span><span id="local-6989586621681135295"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135295"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135294"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681135293"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135293"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681135292"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1595"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135291"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135290"><span class="hs-identifier hs-var">gs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span>  </span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681135289"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135289"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681135291"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135291"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621681135290"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135290"><span class="hs-identifier hs-var">gs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135295"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-1596"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135289"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1597"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135289"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135291"><span class="hs-identifier hs-var">xs</span></a></span><span>    </span><span class="hs-comment">-- Note [Partial export]</span><span>
</span><span id="line-1598"></span><span>                 </span><span class="hs-special">]</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1599"></span><span>           </span><span class="hs-special">[</span><span id="local-6989586621681135288"><span class="annot"><span class="annottext">([Name], [FieldLabel])
</span><a href="#local-6989586621681135288"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">([Name], [FieldLabel]) -&gt; Bool
</span><a href="#local-6989586621681135287"><span class="hs-identifier hs-var">all_used</span></a></span><span> </span><span class="annot"><span class="annottext">([Name], [FieldLabel])
</span><a href="#local-6989586621681135288"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">XIEThingAll GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass.
XIEThingAll pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-var">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAll GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1600"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1601"></span><span>                   </span><span class="hs-special">[</span><span class="annot"><span class="annottext">XIEThingWith GhcRn
-&gt; LIEWrappedName (IdP GhcRn)
-&gt; IEWildcard
-&gt; [LIEWrappedName (IdP GhcRn)]
-&gt; [Located (FieldLbl (IdP GhcRn))]
-&gt; IE GhcRn
forall pass.
XIEThingWith pass
-&gt; LIEWrappedName (IdP pass)
-&gt; IEWildcard
-&gt; [LIEWrappedName (IdP pass)]
-&gt; [Located (FieldLbl (IdP pass))]
-&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingWith"><span class="hs-identifier hs-var">IEThingWith</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingWith GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IEWildcard
</span><a href="GHC.Hs.ImpExp.html#NoIEWildcard"><span class="hs-identifier hs-var">NoIEWildcard</span></a></span><span>
</span><span id="line-1602"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; [Name] -&gt; [GenLocated SrcSpan (IEWrappedName Name)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; (Name -&gt; Located Name)
-&gt; Name
-&gt; GenLocated SrcSpan (IEWrappedName Name)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; [Name]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135293"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1603"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(FieldLabel -&gt; Located FieldLabel)
-&gt; [FieldLabel] -&gt; [Located FieldLabel]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; Located FieldLabel
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1604"></span><span>                                          </span><span class="hs-comment">-- Note [Overloaded field import]</span><span>
</span><span id="line-1605"></span><span>           </span><span id="local-6989586621681135285"><span class="annot"><span class="annottext">[([Name], [FieldLabel])]
</span><a href="#local-6989586621681135285"><span class="hs-identifier hs-var">_other</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; Bool
forall {a}. [FieldLbl a] -&gt; Bool
</span><a href="#local-6989586621681135284"><span class="hs-identifier hs-var">all_non_overloaded</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-1606"></span><span>                           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; IE GhcRn) -&gt; [Name] -&gt; [IE GhcRn]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEVar GhcRn -&gt; LIEWrappedName (IdP GhcRn) -&gt; IE GhcRn
forall pass. XIEVar pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEVar"><span class="hs-identifier hs-var">IEVar</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEVar GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (IEWrappedName Name) -&gt; IE GhcRn)
-&gt; (Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Name
-&gt; IE GhcRn
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn_var"><span class="hs-identifier hs-var">to_ie_post_rn_var</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; (Name -&gt; Located Name)
-&gt; Name
-&gt; GenLocated SrcSpan (IEWrappedName Name)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([Name] -&gt; [IE GhcRn]) -&gt; [Name] -&gt; [IE GhcRn]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135293"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-1607"></span><span>                                 </span><span class="annot"><span class="annottext">[Name] -&gt; [Name] -&gt; [Name]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(FieldLabel -&gt; Name) -&gt; [FieldLabel] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-1608"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1609"></span><span>                      </span><span class="hs-special">[</span><span class="annot"><span class="annottext">XIEThingWith GhcRn
-&gt; LIEWrappedName (IdP GhcRn)
-&gt; IEWildcard
-&gt; [LIEWrappedName (IdP GhcRn)]
-&gt; [Located (FieldLbl (IdP GhcRn))]
-&gt; IE GhcRn
forall pass.
XIEThingWith pass
-&gt; LIEWrappedName (IdP pass)
-&gt; IEWildcard
-&gt; [LIEWrappedName (IdP pass)]
-&gt; [Located (FieldLbl (IdP pass))]
-&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingWith"><span class="hs-identifier hs-var">IEThingWith</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingWith GhcRn
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IEWildcard
</span><a href="GHC.Hs.ImpExp.html#NoIEWildcard"><span class="hs-identifier hs-var">NoIEWildcard</span></a></span><span>
</span><span id="line-1610"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; [Name] -&gt; [GenLocated SrcSpan (IEWrappedName Name)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name)
forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var">to_ie_post_rn</span></a></span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; GenLocated SrcSpan (IEWrappedName Name))
-&gt; (Name -&gt; Located Name)
-&gt; Name
-&gt; GenLocated SrcSpan (IEWrappedName Name)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Located Name
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; [Name]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135294"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135293"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1611"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(FieldLabel -&gt; Located FieldLabel)
-&gt; [FieldLabel] -&gt; [Located FieldLabel]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; Located FieldLabel
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1612"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-1613"></span><span>
</span><span id="line-1614"></span><span>          </span><span id="local-6989586621681135282"><span class="annot"><span class="annottext">fld_lbls :: [FastString]
</span><a href="#local-6989586621681135282"><span class="hs-identifier hs-var hs-var">fld_lbls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(FieldLabel -&gt; FastString) -&gt; [FieldLabel] -&gt; [FastString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; FastString
forall a. FieldLbl a -&gt; FastString
</span><a href="GHC.Types.FieldLabel.html#flLabel"><span class="hs-identifier hs-var hs-var">flLabel</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135292"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-1615"></span><span>
</span><span id="line-1616"></span><span>          </span><span id="local-6989586621681135287"><span class="annot"><span class="annottext">all_used :: ([Name], [FieldLabel]) -&gt; Bool
</span><a href="#local-6989586621681135287"><span class="hs-identifier hs-var hs-var">all_used</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681135281"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135281"><span class="hs-identifier hs-var">avail_occs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681135280"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135280"><span class="hs-identifier hs-var">avail_flds</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1617"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135293"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135281"><span class="hs-identifier hs-var">avail_occs</span></a></span><span>
</span><span id="line-1618"></span><span>                    </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Bool) -&gt; [FastString] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; [FastString] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[FastString]
</span><a href="#local-6989586621681135282"><span class="hs-identifier hs-var">fld_lbls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(FieldLabel -&gt; FastString) -&gt; [FieldLabel] -&gt; [FastString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; FastString
forall a. FieldLbl a -&gt; FastString
</span><a href="GHC.Types.FieldLabel.html#flLabel"><span class="hs-identifier hs-var hs-var">flLabel</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681135280"><span class="hs-identifier hs-var">avail_flds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1619"></span><span>
</span><span id="line-1620"></span><span>          </span><span id="local-6989586621681135284"><span class="annot"><span class="annottext">all_non_overloaded :: [FieldLbl a] -&gt; Bool
</span><a href="#local-6989586621681135284"><span class="hs-identifier hs-var hs-var">all_non_overloaded</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(FieldLbl a -&gt; Bool) -&gt; [FieldLbl a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (FieldLbl a -&gt; Bool) -&gt; FieldLbl a -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl a -&gt; Bool
forall a. FieldLbl a -&gt; Bool
</span><a href="GHC.Types.FieldLabel.html#flIsOverloaded"><span class="hs-identifier hs-var hs-var">flIsOverloaded</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1621"></span><span>
</span><span id="line-1622"></span><span class="annot"><a href="GHC.Rename.Names.html#printMinimalImports"><span class="hs-identifier hs-type">printMinimalImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Rename.Names.html#ImportDeclUsage"><span class="hs-identifier hs-type">ImportDeclUsage</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#RnM"><span class="hs-identifier hs-type">RnM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1623"></span><span class="hs-comment">-- See Note [Printing minimal imports]</span><span>
</span><span id="line-1624"></span><span id="printMinimalImports"><span class="annot"><span class="annottext">printMinimalImports :: HscSource -&gt; [ImportDeclUsage] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#printMinimalImports"><span class="hs-identifier hs-var hs-var">printMinimalImports</span></a></span></span><span> </span><span id="local-6989586621681135277"><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135277"><span class="hs-identifier hs-var">hsc_src</span></a></span></span><span> </span><span id="local-6989586621681135276"><span class="annot"><span class="annottext">[ImportDeclUsage]
</span><a href="#local-6989586621681135276"><span class="hs-identifier hs-var">imports_w_usage</span></a></span></span><span>
</span><span id="line-1625"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681135275"><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681135275"><span class="hs-identifier hs-var">imports'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage] -&gt; RnM [LImportDecl GhcRn]
</span><a href="GHC.Rename.Names.html#getMinimalImports"><span class="hs-identifier hs-var">getMinimalImports</span></a></span><span> </span><span class="annot"><span class="annottext">[ImportDeclUsage]
</span><a href="#local-6989586621681135276"><span class="hs-identifier hs-var">imports_w_usage</span></a></span><span>
</span><span id="line-1626"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135274"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681135274"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-1627"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681135272"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681135272"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-1628"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; IO () -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IOMode -&gt; (Handle -&gt; IO ()) -&gt; IO ()
forall r. String -&gt; IOMode -&gt; (Handle -&gt; IO r) -&gt; IO r
</span><a href="../../base/src/System.IO.html#withFile"><span class="hs-identifier hs-var">withFile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; String
</span><a href="#local-6989586621681135269"><span class="hs-identifier hs-var">mkFilename</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681135272"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681135274"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#WriteMode"><span class="hs-identifier hs-var">WriteMode</span></a></span><span> </span><span class="annot"><span class="annottext">((Handle -&gt; IO ()) -&gt; IO ()) -&gt; (Handle -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681135267"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621681135267"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1629"></span><span>          </span><span class="annot"><span class="annottext">DynFlags -&gt; Handle -&gt; PrintUnqualified -&gt; Depth -&gt; MsgDoc -&gt; IO ()
</span><a href="GHC.Utils.Outputable.html#printForUser"><span class="hs-identifier hs-var">printForUser</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681135272"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621681135267"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">PrintUnqualified
</span><a href="GHC.Utils.Outputable.html#neverQualify"><span class="hs-identifier hs-var">neverQualify</span></a></span><span> </span><span class="annot"><span class="annottext">Depth
</span><a href="GHC.Utils.Outputable.html#AllTheWay"><span class="hs-identifier hs-var">AllTheWay</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LImportDecl GhcRn -&gt; MsgDoc) -&gt; [LImportDecl GhcRn] -&gt; [MsgDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcRn -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcRn]
</span><a href="#local-6989586621681135275"><span class="hs-identifier hs-var">imports'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1630"></span><span>              </span><span class="hs-comment">-- The neverQualify is important.  We are printing Names</span><span>
</span><span id="line-1631"></span><span>              </span><span class="hs-comment">-- but they are in the context of an 'import' decl, and</span><span>
</span><span id="line-1632"></span><span>              </span><span class="hs-comment">-- we never qualify things inside there</span><span>
</span><span id="line-1633"></span><span>              </span><span class="hs-comment">-- E.g.   import Blag( f, b )</span><span>
</span><span id="line-1634"></span><span>              </span><span class="hs-comment">-- not    import Blag( Blag.f, Blag.g )!</span><span>
</span><span id="line-1635"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-1636"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1637"></span><span>    </span><span id="local-6989586621681135269"><span class="annot"><span class="annottext">mkFilename :: DynFlags -&gt; Module -&gt; String
</span><a href="#local-6989586621681135269"><span class="hs-identifier hs-var hs-var">mkFilename</span></a></span></span><span> </span><span id="local-6989586621681135263"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681135263"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681135262"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681135262"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span>
</span><span id="line-1638"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135261"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681135261"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe String
</span><a href="GHC.Driver.Session.html#dumpDir"><span class="hs-identifier hs-var hs-var">dumpDir</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681135263"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681135261"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681135259"><span class="hs-identifier hs-var">basefn</span></a></span><span>
</span><span id="line-1639"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681135259"><span class="hs-identifier hs-var">basefn</span></a></span><span>
</span><span id="line-1640"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1641"></span><span>        </span><span id="local-6989586621681135258"><span class="annot"><span class="annottext">suffix :: String
</span><a href="#local-6989586621681135258"><span class="hs-identifier hs-var hs-var">suffix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681135277"><span class="hs-identifier hs-var">hsc_src</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1642"></span><span>                     </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsBootFile"><span class="hs-identifier hs-var">HsBootFile</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.imports-boot&quot;</span></span><span>
</span><span id="line-1643"></span><span>                     </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsSrcFile"><span class="hs-identifier hs-var">HsSrcFile</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.imports&quot;</span></span><span>
</span><span id="line-1644"></span><span>                     </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsigFile"><span class="hs-identifier hs-var">HsigFile</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.imports&quot;</span></span><span>
</span><span id="line-1645"></span><span>        </span><span id="local-6989586621681135259"><span class="annot"><span class="annottext">basefn :: String
</span><a href="#local-6989586621681135259"><span class="hs-identifier hs-var hs-var">basefn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; String
</span><a href="GHC.Unit.Module.Name.html#moduleNameString"><span class="hs-identifier hs-var">moduleNameString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681135262"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681135258"><span class="hs-identifier hs-var">suffix</span></a></span><span>
</span><span id="line-1646"></span><span>
</span><span id="line-1647"></span><span>
</span><span id="line-1648"></span><span id="local-6989586621681135253"><span class="annot"><a href="GHC.Rename.Names.html#to_ie_post_rn_var"><span class="hs-identifier hs-type">to_ie_post_rn_var</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#HasOccName"><span class="hs-identifier hs-type">HasOccName</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681135253"><span class="hs-identifier hs-type">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681135253"><span class="hs-identifier hs-type">name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIEWrappedName"><span class="hs-identifier hs-type">LIEWrappedName</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681135253"><span class="hs-identifier hs-type">name</span></a></span></span><span>
</span><span id="line-1649"></span><span id="to_ie_post_rn_var"><span class="annot"><span class="annottext">to_ie_post_rn_var :: forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn_var"><span class="hs-identifier hs-var hs-var">to_ie_post_rn_var</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135250"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135250"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135249"><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135249"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1650"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#isDataOcc"><span class="hs-identifier hs-var">isDataOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; Bool) -&gt; OccName -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135249"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName name -&gt; GenLocated SrcSpan (IEWrappedName name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135250"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan name -&gt; IEWrappedName name
forall name. Located name -&gt; IEWrappedName name
</span><a href="GHC.Hs.ImpExp.html#IEPattern"><span class="hs-identifier hs-var">IEPattern</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; name -&gt; GenLocated SrcSpan name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135250"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135249"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1651"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName name -&gt; GenLocated SrcSpan (IEWrappedName name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135250"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan name -&gt; IEWrappedName name
forall name. Located name -&gt; IEWrappedName name
</span><a href="GHC.Hs.ImpExp.html#IEName"><span class="hs-identifier hs-var">IEName</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; name -&gt; GenLocated SrcSpan name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135250"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135249"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1652"></span><span>
</span><span id="line-1653"></span><span>
</span><span id="line-1654"></span><span id="local-6989586621681136754"><span class="annot"><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-type">to_ie_post_rn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#HasOccName"><span class="hs-identifier hs-type">HasOccName</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136754"><span class="hs-identifier hs-type">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136754"><span class="hs-identifier hs-type">name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIEWrappedName"><span class="hs-identifier hs-type">LIEWrappedName</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136754"><span class="hs-identifier hs-type">name</span></a></span></span><span>
</span><span id="line-1655"></span><span id="to_ie_post_rn"><span class="annot"><span class="annottext">to_ie_post_rn :: forall name. HasOccName name =&gt; Located name -&gt; LIEWrappedName name
</span><a href="GHC.Rename.Names.html#to_ie_post_rn"><span class="hs-identifier hs-var hs-var">to_ie_post_rn</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681135242"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135242"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681135241"><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135241"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1656"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#isTcOcc"><span class="hs-identifier hs-var">isTcOcc</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135239"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#isSymOcc"><span class="hs-identifier hs-var">isSymOcc</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135239"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName name -&gt; GenLocated SrcSpan (IEWrappedName name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135242"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan name -&gt; IEWrappedName name
forall name. Located name -&gt; IEWrappedName name
</span><a href="GHC.Hs.ImpExp.html#IEType"><span class="hs-identifier hs-var">IEType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; name -&gt; GenLocated SrcSpan name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135242"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135241"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1657"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IEWrappedName name -&gt; GenLocated SrcSpan (IEWrappedName name)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135242"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan name -&gt; IEWrappedName name
forall name. Located name -&gt; IEWrappedName name
</span><a href="GHC.Hs.ImpExp.html#IEName"><span class="hs-identifier hs-var">IEName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; name -&gt; GenLocated SrcSpan name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681135242"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135241"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1658"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681135239"><span class="annot"><span class="annottext">occ :: OccName
</span><a href="#local-6989586621681135239"><span class="hs-identifier hs-var hs-var">occ</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">name
</span><a href="#local-6989586621681135241"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1659"></span><span>
</span><span id="line-1660"></span><span class="hs-comment">{-
Note [Partial export]
~~~~~~~~~~~~~~~~~~~~~
Suppose we have

   module A( op ) where
     class C a where
       op :: a -&gt; a

   module B where
   import A
   f = ..op...

Then the minimal import for module B is
   import A( op )
not
   import A( C( op ) )
which we would usually generate if C was exported from B.  Hence
the (x `elem` xs) test when deciding what to generate.


Note [Overloaded field import]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On the other hand, if we have

    {-# LANGUAGE DuplicateRecordFields #-}
    module A where
      data T = MkT { foo :: Int }

    module B where
      import A
      f = ...foo...

then the minimal import for module B must be
    import A ( T(foo) )
because when DuplicateRecordFields is enabled, field selectors are
not in scope without their enclosing datatype.


************************************************************************
*                                                                      *
\subsection{Errors}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1705"></span><span>
</span><span id="line-1706"></span><span class="annot"><a href="GHC.Rename.Names.html#qualImportItemErr"><span class="hs-identifier hs-type">qualImportItemErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1707"></span><span id="qualImportItemErr"><span class="annot"><span class="annottext">qualImportItemErr :: RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#qualImportItemErr"><span class="hs-identifier hs-var hs-var">qualImportItemErr</span></a></span></span><span> </span><span id="local-6989586621681135236"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135236"><span class="hs-identifier hs-var">rdr</span></a></span></span><span>
</span><span id="line-1708"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Illegal qualified name in import item:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1709"></span><span>       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135236"><span class="hs-identifier hs-var">rdr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1710"></span><span>
</span><span id="line-1711"></span><span class="annot"><a href="GHC.Rename.Names.html#pprImpDeclSpec"><span class="hs-identifier hs-type">pprImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1712"></span><span id="pprImpDeclSpec"><span class="annot"><span class="annottext">pprImpDeclSpec :: ModIface -&gt; ImpDeclSpec -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#pprImpDeclSpec"><span class="hs-identifier hs-var hs-var">pprImpDeclSpec</span></a></span></span><span> </span><span id="local-6989586621681135234"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135234"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135233"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135233"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1713"></span><span>  </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_mod"><span class="hs-identifier hs-var hs-var">is_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135233"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; IsBootInterface
</span><a href="GHC.Driver.Types.html#mi_boot"><span class="hs-identifier hs-var">mi_boot</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135234"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1714"></span><span>    </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(hi-boot interface)&quot;</span></span><span>
</span><span id="line-1715"></span><span>    </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-1716"></span><span>
</span><span id="line-1717"></span><span class="annot"><a href="GHC.Rename.Names.html#badImportItemErrStd"><span class="hs-identifier hs-type">badImportItemErrStd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1718"></span><span id="badImportItemErrStd"><span class="annot"><span class="annottext">badImportItemErrStd :: ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErrStd"><span class="hs-identifier hs-var hs-var">badImportItemErrStd</span></a></span></span><span> </span><span id="local-6989586621681135231"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135231"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135230"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135230"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span id="local-6989586621681135229"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135229"><span class="hs-identifier hs-var">ie</span></a></span></span><span>
</span><span id="line-1719"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Module&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; ImpDeclSpec -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#pprImpDeclSpec"><span class="hs-identifier hs-var">pprImpDeclSpec</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135231"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135230"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1720"></span><span>         </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;does not export&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135229"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1721"></span><span>
</span><span id="line-1722"></span><span class="annot"><a href="GHC.Rename.Names.html#badImportItemErrDataCon"><span class="hs-identifier hs-type">badImportItemErrDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-1723"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1724"></span><span id="badImportItemErrDataCon"><span class="annot"><span class="annottext">badImportItemErrDataCon :: OccName -&gt; ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErrDataCon"><span class="hs-identifier hs-var hs-var">badImportItemErrDataCon</span></a></span></span><span> </span><span id="local-6989586621681135227"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135227"><span class="hs-identifier hs-var">dataType_occ</span></a></span></span><span> </span><span id="local-6989586621681135226"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135226"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135225"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135225"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span id="local-6989586621681135224"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135224"><span class="hs-identifier hs-var">ie</span></a></span></span><span>
</span><span id="line-1725"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In module&quot;</span></span><span>
</span><span id="line-1726"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; ImpDeclSpec -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#pprImpDeclSpec"><span class="hs-identifier hs-var">pprImpDeclSpec</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135226"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135225"><span class="hs-identifier hs-var">decl_spec</span></a></span><span>
</span><span id="line-1727"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span>
</span><span id="line-1728"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; MsgDoc) -&gt; MsgDoc -&gt; MsgDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135222"><span class="hs-identifier hs-var">datacon</span></a></span><span>
</span><span id="line-1729"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is a data constructor of&quot;</span></span><span>
</span><span id="line-1730"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135221"><span class="hs-identifier hs-var">dataType</span></a></span><span>
</span><span id="line-1731"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;To import it use&quot;</span></span><span>
</span><span id="line-1732"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; MsgDoc) -&gt; MsgDoc -&gt; MsgDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;import&quot;</span></span><span>
</span><span id="line-1733"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_mod"><span class="hs-identifier hs-var hs-var">is_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135225"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1734"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681135220"><span class="hs-identifier hs-var">parens_sp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135221"><span class="hs-identifier hs-var">dataType</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681135220"><span class="hs-identifier hs-var">parens_sp</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135222"><span class="hs-identifier hs-var">datacon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1735"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;or&quot;</span></span><span>
</span><span id="line-1736"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; MsgDoc) -&gt; MsgDoc -&gt; MsgDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;import&quot;</span></span><span>
</span><span id="line-1737"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_mod"><span class="hs-identifier hs-var hs-var">is_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135225"><span class="hs-identifier hs-var">decl_spec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1738"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681135220"><span class="hs-identifier hs-var">parens_sp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135221"><span class="hs-identifier hs-var">dataType</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(..)&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1739"></span><span>         </span><span class="hs-special">]</span><span>
</span><span id="line-1740"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1741"></span><span>    </span><span id="local-6989586621681135219"><span class="annot"><span class="annottext">datacon_occ :: OccName
</span><a href="#local-6989586621681135219"><span class="hs-identifier hs-var hs-var">datacon_occ</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; OccName) -&gt; RdrName -&gt; OccName
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; IdP GhcPs
forall (p :: Pass). IE (GhcPass p) -&gt; IdP (GhcPass p)
</span><a href="GHC.Hs.ImpExp.html#ieName"><span class="hs-identifier hs-var">ieName</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135224"><span class="hs-identifier hs-var">ie</span></a></span><span>
</span><span id="line-1742"></span><span>    </span><span id="local-6989586621681135222"><span class="annot"><span class="annottext">datacon :: MsgDoc
</span><a href="#local-6989586621681135222"><span class="hs-identifier hs-var hs-var">datacon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Types.Name.Occurrence.html#parenSymOcc"><span class="hs-identifier hs-var">parenSymOcc</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135219"><span class="hs-identifier hs-var">datacon_occ</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135219"><span class="hs-identifier hs-var">datacon_occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1743"></span><span>    </span><span id="local-6989586621681135221"><span class="annot"><span class="annottext">dataType :: MsgDoc
</span><a href="#local-6989586621681135221"><span class="hs-identifier hs-var hs-var">dataType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Types.Name.Occurrence.html#parenSymOcc"><span class="hs-identifier hs-var">parenSymOcc</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135227"><span class="hs-identifier hs-var">dataType_occ</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681135227"><span class="hs-identifier hs-var">dataType_occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1744"></span><span>    </span><span id="local-6989586621681135220"><span class="annot"><span class="annottext">parens_sp :: MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681135220"><span class="hs-identifier hs-var hs-var">parens_sp</span></a></span></span><span> </span><span id="local-6989586621681135217"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135217"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135217"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- T( f,g )</span><span>
</span><span id="line-1745"></span><span>
</span><span id="line-1746"></span><span class="annot"><a href="GHC.Rename.Names.html#badImportItemErr"><span class="hs-identifier hs-type">badImportItemErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1747"></span><span id="badImportItemErr"><span class="annot"><span class="annottext">badImportItemErr :: ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; [AvailInfo] -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErr"><span class="hs-identifier hs-var hs-var">badImportItemErr</span></a></span></span><span> </span><span id="local-6989586621681135215"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135215"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span id="local-6989586621681135214"><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135214"><span class="hs-identifier hs-var">decl_spec</span></a></span></span><span> </span><span id="local-6989586621681135213"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135213"><span class="hs-identifier hs-var">ie</span></a></span></span><span> </span><span id="local-6989586621681135212"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135212"><span class="hs-identifier hs-var">avails</span></a></span></span><span>
</span><span id="line-1748"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; Bool) -&gt; [AvailInfo] -&gt; Maybe AvailInfo
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Bool
</span><a href="#local-6989586621681135211"><span class="hs-identifier hs-var">checkIfDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681135212"><span class="hs-identifier hs-var">avails</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1749"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135210"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135210"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErrDataCon"><span class="hs-identifier hs-var">badImportItemErrDataCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AvailInfo -&gt; OccName
</span><a href="#local-6989586621681135209"><span class="hs-identifier hs-var">availOccName</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681135210"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135215"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135214"><span class="hs-identifier hs-var">decl_spec</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135213"><span class="hs-identifier hs-var">ie</span></a></span><span>
</span><span id="line-1750"></span><span>      </span><span class="annot"><span class="annottext">Maybe AvailInfo
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; ImpDeclSpec -&gt; IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badImportItemErrStd"><span class="hs-identifier hs-var">badImportItemErrStd</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681135215"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681135214"><span class="hs-identifier hs-var">decl_spec</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135213"><span class="hs-identifier hs-var">ie</span></a></span><span>
</span><span id="line-1751"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1752"></span><span>    </span><span id="local-6989586621681135211"><span class="annot"><span class="annottext">checkIfDataCon :: AvailInfo -&gt; Bool
</span><a href="#local-6989586621681135211"><span class="hs-identifier hs-var hs-var">checkIfDataCon</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135208"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135208"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1753"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; [Name] -&gt; Maybe Name
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681135207"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135207"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681135206"><span class="hs-identifier hs-var">importedFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; FastString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; FastString
</span><a href="#local-6989586621681135205"><span class="hs-identifier hs-var">nameOccNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135207"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135208"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1754"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681135204"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135204"><span class="hs-identifier hs-var">n</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isDataConName"><span class="hs-identifier hs-var">isDataConName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681135204"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1755"></span><span>        </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1756"></span><span>    </span><span class="annot"><a href="#local-6989586621681135211"><span class="hs-identifier hs-var">checkIfDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1757"></span><span>    </span><span id="local-6989586621681135209"><span class="annot"><span class="annottext">availOccName :: AvailInfo -&gt; OccName
</span><a href="#local-6989586621681135209"><span class="hs-identifier hs-var hs-var">availOccName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; OccName) -&gt; (AvailInfo -&gt; Name) -&gt; AvailInfo -&gt; OccName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span>
</span><span id="line-1758"></span><span>    </span><span id="local-6989586621681135205"><span class="annot"><span class="annottext">nameOccNameFS :: Name -&gt; FastString
</span><a href="#local-6989586621681135205"><span class="hs-identifier hs-var hs-var">nameOccNameFS</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString) -&gt; (Name -&gt; OccName) -&gt; Name -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span>
</span><span id="line-1759"></span><span>    </span><span id="local-6989586621681135206"><span class="annot"><span class="annottext">importedFS :: FastString
</span><a href="#local-6989586621681135206"><span class="hs-identifier hs-var hs-var">importedFS</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString)
-&gt; (RdrName -&gt; OccName) -&gt; RdrName -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#rdrNameOcc"><span class="hs-identifier hs-var">rdrNameOcc</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; FastString) -&gt; RdrName -&gt; FastString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs -&gt; IdP GhcPs
forall (p :: Pass). IE (GhcPass p) -&gt; IdP (GhcPass p)
</span><a href="GHC.Hs.ImpExp.html#ieName"><span class="hs-identifier hs-var">ieName</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135213"><span class="hs-identifier hs-var">ie</span></a></span><span>
</span><span id="line-1760"></span><span>
</span><span id="line-1761"></span><span class="annot"><a href="GHC.Rename.Names.html#illegalImportItemErr"><span class="hs-identifier hs-type">illegalImportItemErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1762"></span><span id="illegalImportItemErr"><span class="annot"><span class="annottext">illegalImportItemErr :: MsgDoc
</span><a href="GHC.Rename.Names.html#illegalImportItemErr"><span class="hs-identifier hs-var hs-var">illegalImportItemErr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Illegal import item&quot;</span></span><span>
</span><span id="line-1763"></span><span>
</span><span id="line-1764"></span><span class="annot"><a href="GHC.Rename.Names.html#dodgyImportWarn"><span class="hs-identifier hs-type">dodgyImportWarn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1765"></span><span id="dodgyImportWarn"><span class="annot"><span class="annottext">dodgyImportWarn :: RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#dodgyImportWarn"><span class="hs-identifier hs-var hs-var">dodgyImportWarn</span></a></span></span><span> </span><span id="local-6989586621681135201"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135201"><span class="hs-identifier hs-var">item</span></a></span></span><span>
</span><span id="line-1766"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; RdrName -&gt; IE GhcPs -&gt; MsgDoc
forall a b.
(Outputable a, Outputable b) =&gt;
MsgDoc -&gt; a -&gt; b -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#dodgyMsg"><span class="hs-identifier hs-var">dodgyMsg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;import&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135201"><span class="hs-identifier hs-var">item</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdP GhcPs -&gt; IE GhcPs
forall (p :: Pass). IdP (GhcPass p) -&gt; IE (GhcPass p)
</span><a href="GHC.Rename.Names.html#dodgyMsgInsert"><span class="hs-identifier hs-var">dodgyMsgInsert</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681135201"><span class="hs-identifier hs-var">item</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1767"></span><span>
</span><span id="line-1768"></span><span id="local-6989586621681136668"><span id="local-6989586621681136669"><span class="annot"><a href="GHC.Rename.Names.html#dodgyMsg"><span class="hs-identifier hs-type">dodgyMsg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136669"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136668"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681136669"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681136668"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span></span></span><span>
</span><span id="line-1769"></span><span id="dodgyMsg"><span class="annot"><span class="annottext">dodgyMsg :: forall a b.
(Outputable a, Outputable b) =&gt;
MsgDoc -&gt; a -&gt; b -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#dodgyMsg"><span class="hs-identifier hs-var hs-var">dodgyMsg</span></a></span></span><span> </span><span id="local-6989586621681135196"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135196"><span class="hs-identifier hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621681135195"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135195"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681135194"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681135194"><span class="hs-identifier hs-var">ie</span></a></span></span><span>
</span><span id="line-1770"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;The&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681135196"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;item&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1771"></span><span>                    </span><span class="hs-comment">-- &lt;+&gt; quotes (ppr (IEThingAll (noLoc (IEName $ noLoc tc))))</span><span>
</span><span id="line-1772"></span><span>                     </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681135194"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1773"></span><span>                </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;suggests that&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-1774"></span><span>          </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681135195"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;has (in-scope) constructors or class methods,&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-1775"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;but it has none&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1776"></span><span>
</span><span id="line-1777"></span><span class="annot"><a href="GHC.Rename.Names.html#dodgyMsgInsert"><span class="hs-identifier hs-type">dodgyMsgInsert</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681136667"><span class="annot"><a href="#local-6989586621681136667"><span class="hs-identifier hs-type">p</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#IdP"><span class="hs-identifier hs-type">IdP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136667"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136667"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1778"></span><span id="dodgyMsgInsert"><span class="annot"><span class="annottext">dodgyMsgInsert :: forall (p :: Pass). IdP (GhcPass p) -&gt; IE (GhcPass p)
</span><a href="GHC.Rename.Names.html#dodgyMsgInsert"><span class="hs-identifier hs-var hs-var">dodgyMsgInsert</span></a></span></span><span> </span><span id="local-6989586621681135193"><span class="annot"><span class="annottext">IdP (GhcPass p)
</span><a href="#local-6989586621681135193"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XIEThingAll (GhcPass p)
-&gt; LIEWrappedName (IdP (GhcPass p)) -&gt; IE (GhcPass p)
forall pass.
XIEThingAll pass -&gt; LIEWrappedName (IdP pass) -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEThingAll"><span class="hs-identifier hs-var">IEThingAll</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEThingAll (GhcPass p)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">LIEWrappedName (IdP (GhcPass p))
</span><a href="#local-6989586621681135192"><span class="hs-identifier hs-var">ii</span></a></span><span>
</span><span id="line-1779"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1780"></span><span>    </span><span class="annot"><a href="#local-6989586621681135192"><span class="hs-identifier hs-type">ii</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIEWrappedName"><span class="hs-identifier hs-type">LIEWrappedName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#IdP"><span class="hs-identifier hs-type">IdP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681136667"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1781"></span><span>    </span><span id="local-6989586621681135192"><span class="annot"><span class="annottext">ii :: LIEWrappedName (IdP (GhcPass p))
</span><a href="#local-6989586621681135192"><span class="hs-identifier hs-var hs-var">ii</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IEWrappedName (IdGhcP p) -&gt; Located (IEWrappedName (IdGhcP p))
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (IdGhcP p) -&gt; IEWrappedName (IdGhcP p)
forall name. Located name -&gt; IEWrappedName name
</span><a href="GHC.Hs.ImpExp.html#IEName"><span class="hs-identifier hs-var">IEName</span></a></span><span> </span><span class="annot"><span class="annottext">(Located (IdGhcP p) -&gt; IEWrappedName (IdGhcP p))
-&gt; Located (IdGhcP p) -&gt; IEWrappedName (IdGhcP p)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IdGhcP p -&gt; Located (IdGhcP p)
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">IdGhcP p
IdP (GhcPass p)
</span><a href="#local-6989586621681135193"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1782"></span><span>
</span><span id="line-1783"></span><span>
</span><span id="line-1784"></span><span class="annot"><a href="GHC.Rename.Names.html#addDupDeclErr"><span class="hs-identifier hs-type">addDupDeclErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrElt"><span class="hs-identifier hs-type">GlobalRdrElt</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1785"></span><span id="addDupDeclErr"><span class="annot"><span class="annottext">addDupDeclErr :: [GlobalRdrElt] -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#addDupDeclErr"><span class="hs-identifier hs-var hs-var">addDupDeclErr</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;addDupDeclErr: empty list&quot;</span></span><span>
</span><span id="line-1786"></span><span class="annot"><a href="GHC.Rename.Names.html#addDupDeclErr"><span class="hs-identifier hs-var">addDupDeclErr</span></a></span><span> </span><span id="local-6989586621681135191"><span class="annot"><span class="annottext">gres :: [GlobalRdrElt]
</span><a href="#local-6989586621681135191"><span class="hs-identifier hs-var">gres</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681135190"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135190"><span class="hs-identifier hs-var">gre</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-1787"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrAt"><span class="hs-identifier hs-var">addErrAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
forall a. NamedThing a =&gt; a -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#getSrcSpan"><span class="hs-identifier hs-var">getSrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; Name
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135187"><span class="hs-identifier hs-var">sorted_names</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ())
-&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1788"></span><span>    </span><span class="hs-comment">-- Report the error at the later location</span><span>
</span><span id="line-1789"></span><span>    </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Multiple declarations of&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-1790"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; OccName
</span><a href="GHC.Types.Name.Reader.html#greOccName"><span class="hs-identifier hs-var">greOccName</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681135190"><span class="hs-identifier hs-var">gre</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1791"></span><span>             </span><span class="hs-comment">-- NB. print the OccName, not the Name, because the</span><span>
</span><span id="line-1792"></span><span>             </span><span class="hs-comment">-- latter might not be in scope in the RdrEnv and so will</span><span>
</span><span id="line-1793"></span><span>             </span><span class="hs-comment">-- be printed qualified.</span><span>
</span><span id="line-1794"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Declared at:&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-1795"></span><span>                   </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; MsgDoc) -&gt; [Name] -&gt; [MsgDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(SrcLoc -&gt; MsgDoc) -&gt; (Name -&gt; SrcLoc) -&gt; Name -&gt; MsgDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SrcLoc
</span><a href="GHC.Types.Name.html#nameSrcLoc"><span class="hs-identifier hs-var">nameSrcLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681135187"><span class="hs-identifier hs-var">sorted_names</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1796"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1797"></span><span>    </span><span id="local-6989586621681135187"><span class="annot"><span class="annottext">sorted_names :: [Name]
</span><a href="#local-6989586621681135187"><span class="hs-identifier hs-var hs-var">sorted_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1798"></span><span>      </span><span class="annot"><span class="annottext">(Name -&gt; Name -&gt; Ordering) -&gt; [Name] -&gt; [Name]
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier hs-var">sortBy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcSpan -&gt; Ordering
</span><a href="GHC.Types.SrcLoc.html#leftmost_smallest"><span class="hs-identifier hs-var">SrcLoc.leftmost_smallest</span></a></span><span> </span><span class="annot"><span class="annottext">(SrcSpan -&gt; SrcSpan -&gt; Ordering)
-&gt; (Name -&gt; SrcSpan) -&gt; Name -&gt; Name -&gt; Ordering
forall b c a. (b -&gt; b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; a -&gt; c
</span><a href="../../base/src/Data.Function.html#on"><span class="hs-operator hs-var">`on`</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1799"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GlobalRdrElt -&gt; Name) -&gt; [GlobalRdrElt] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><a href="#local-6989586621681135191"><span class="hs-identifier hs-var">gres</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1800"></span><span>
</span><span id="line-1801"></span><span>
</span><span id="line-1802"></span><span>
</span><span id="line-1803"></span><span class="annot"><a href="GHC.Rename.Names.html#missingImportListWarn"><span class="hs-identifier hs-type">missingImportListWarn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1804"></span><span id="missingImportListWarn"><span class="annot"><span class="annottext">missingImportListWarn :: ModuleName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#missingImportListWarn"><span class="hs-identifier hs-var hs-var">missingImportListWarn</span></a></span></span><span> </span><span id="local-6989586621681135183"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135183"><span class="hs-identifier hs-var">mod</span></a></span></span><span>
</span><span id="line-1805"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;The module&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135183"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;does not have an explicit import list&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1806"></span><span>
</span><span id="line-1807"></span><span class="annot"><a href="GHC.Rename.Names.html#missingImportListItem"><span class="hs-identifier hs-type">missingImportListItem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#IE"><span class="hs-identifier hs-type">IE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1808"></span><span id="missingImportListItem"><span class="annot"><span class="annottext">missingImportListItem :: IE GhcPs -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#missingImportListItem"><span class="hs-identifier hs-var hs-var">missingImportListItem</span></a></span></span><span> </span><span id="local-6989586621681135182"><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135182"><span class="hs-identifier hs-var">ie</span></a></span></span><span>
</span><span id="line-1809"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;The import item&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IE GhcPs -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">IE GhcPs
</span><a href="#local-6989586621681135182"><span class="hs-identifier hs-var">ie</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;does not have an explicit import list&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1810"></span><span>
</span><span id="line-1811"></span><span class="annot"><a href="GHC.Rename.Names.html#moduleWarn"><span class="hs-identifier hs-type">moduleWarn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#WarningTxt"><span class="hs-identifier hs-type">WarningTxt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1812"></span><span id="moduleWarn"><span class="annot"><span class="annottext">moduleWarn :: ModuleName -&gt; WarningTxt -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#moduleWarn"><span class="hs-identifier hs-var hs-var">moduleWarn</span></a></span></span><span> </span><span id="local-6989586621681135181"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135181"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#WarningTxt"><span class="hs-identifier hs-type">WarningTxt</span></a></span><span> </span><span class="annot"><span class="annottext">Located SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135179"><span class="annot"><span class="annottext">[Located StringLiteral]
</span><a href="#local-6989586621681135179"><span class="hs-identifier hs-var">txt</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1813"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Module&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135181"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;:&quot;</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1814"></span><span>          </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located StringLiteral -&gt; MsgDoc)
-&gt; [Located StringLiteral] -&gt; [MsgDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; MsgDoc)
-&gt; (Located StringLiteral -&gt; FastString)
-&gt; Located StringLiteral
-&gt; MsgDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString)
-&gt; (Located StringLiteral -&gt; StringLiteral)
-&gt; Located StringLiteral
-&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located StringLiteral -&gt; StringLiteral
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located StringLiteral]
</span><a href="#local-6989586621681135179"><span class="hs-identifier hs-var">txt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1815"></span><span class="annot"><a href="GHC.Rename.Names.html#moduleWarn"><span class="hs-identifier hs-var">moduleWarn</span></a></span><span> </span><span id="local-6989586621681135178"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135178"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#DeprecatedTxt"><span class="hs-identifier hs-type">DeprecatedTxt</span></a></span><span> </span><span class="annot"><span class="annottext">Located SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681135176"><span class="annot"><span class="annottext">[Located StringLiteral]
</span><a href="#local-6989586621681135176"><span class="hs-identifier hs-var">txt</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1816"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Module&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681135178"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1817"></span><span>                                </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is deprecated:&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-1818"></span><span>          </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located StringLiteral -&gt; MsgDoc)
-&gt; [Located StringLiteral] -&gt; [MsgDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; MsgDoc)
-&gt; (Located StringLiteral -&gt; FastString)
-&gt; Located StringLiteral
-&gt; MsgDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString)
-&gt; (Located StringLiteral -&gt; StringLiteral)
-&gt; Located StringLiteral
-&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located StringLiteral -&gt; StringLiteral
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located StringLiteral]
</span><a href="#local-6989586621681135176"><span class="hs-identifier hs-var">txt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1819"></span><span>
</span><span id="line-1820"></span><span class="annot"><a href="GHC.Rename.Names.html#packageImportErr"><span class="hs-identifier hs-type">packageImportErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1821"></span><span id="packageImportErr"><span class="annot"><span class="annottext">packageImportErr :: MsgDoc
</span><a href="GHC.Rename.Names.html#packageImportErr"><span class="hs-identifier hs-var hs-var">packageImportErr</span></a></span></span><span>
</span><span id="line-1822"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Package-qualified imports are not enabled; use PackageImports&quot;</span></span><span>
</span><span id="line-1823"></span><span>
</span><span id="line-1824"></span><span class="hs-comment">-- This data decl will parse OK</span><span>
</span><span id="line-1825"></span><span class="hs-comment">--      data T = a Int</span><span>
</span><span id="line-1826"></span><span class="hs-comment">-- treating &quot;a&quot; as the constructor.</span><span>
</span><span id="line-1827"></span><span class="hs-comment">-- It is really hard to make the parser spot this malformation.</span><span>
</span><span id="line-1828"></span><span class="hs-comment">-- So the renamer has to check that the constructor is legal</span><span>
</span><span id="line-1829"></span><span class="hs-comment">--</span><span>
</span><span id="line-1830"></span><span class="hs-comment">-- We can get an operator as the constructor, even in the prefix form:</span><span>
</span><span id="line-1831"></span><span class="hs-comment">--      data T = :% Int Int</span><span>
</span><span id="line-1832"></span><span class="hs-comment">-- from interface files, which always print in prefix form</span><span>
</span><span id="line-1833"></span><span>
</span><span id="line-1834"></span><span class="annot"><a href="GHC.Rename.Names.html#checkConName"><span class="hs-identifier hs-type">checkConName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1835"></span><span id="checkConName"><span class="annot"><span class="annottext">checkConName :: RdrName -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Rename.Names.html#checkConName"><span class="hs-identifier hs-var hs-var">checkConName</span></a></span></span><span> </span><span id="local-6989586621681135175"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135175"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; MsgDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ()
</span><a href="GHC.Tc.Utils.Monad.html#checkErr"><span class="hs-identifier hs-var">checkErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; Bool
</span><a href="GHC.Types.Name.Reader.html#isRdrDataCon"><span class="hs-identifier hs-var">isRdrDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135175"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badDataCon"><span class="hs-identifier hs-var">badDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135175"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1836"></span><span>
</span><span id="line-1837"></span><span class="annot"><a href="GHC.Rename.Names.html#badDataCon"><span class="hs-identifier hs-type">badDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1838"></span><span id="badDataCon"><span class="annot"><span class="annottext">badDataCon :: RdrName -&gt; MsgDoc
</span><a href="GHC.Rename.Names.html#badDataCon"><span class="hs-identifier hs-var hs-var">badDataCon</span></a></span></span><span> </span><span id="local-6989586621681135171"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135171"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1839"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Illegal data constructor name&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681135171"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1840"></span></pre></body></html>